[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 7/7] 9pfs: clarify latency of v9fs_co_run_in_worker()
From: |
Christian Schoenebeck |
Subject: |
[PULL 7/7] 9pfs: clarify latency of v9fs_co_run_in_worker() |
Date: |
Wed, 29 Jul 2020 10:42:28 +0200 |
As we just fixed a severe performance issue with Treaddir request
handling, clarify this overall issue as a comment on
v9fs_co_run_in_worker() with the intention to hopefully prevent
such performance mistakes in future (and fixing other yet
outstanding ones).
Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
Message-Id:
<4d34d332e1aaa8a2cf8dc0b5da4fd7727f2a86e8.1596012787.git.qemu_oss@crudebyte.com>
Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
---
hw/9pfs/coth.h | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/hw/9pfs/coth.h b/hw/9pfs/coth.h
index fd4a45bc7c..c51289903d 100644
--- a/hw/9pfs/coth.h
+++ b/hw/9pfs/coth.h
@@ -19,7 +19,7 @@
#include "qemu/coroutine.h"
#include "9p.h"
-/*
+/**
* we want to use bottom half because we want to make sure the below
* sequence of events.
*
@@ -28,6 +28,16 @@
* 3. Enter the coroutine in the worker thread.
* we cannot swap step 1 and 2, because that would imply worker thread
* can enter coroutine while step1 is still running
+ *
+ * @b PERFORMANCE @b CONSIDERATIONS: As a rule of thumb, keep in mind
+ * that hopping between threads adds @b latency! So when handling a
+ * 9pfs request, avoid calling v9fs_co_run_in_worker() too often, because
+ * this might otherwise sum up to a significant, huge overall latency for
+ * providing the response for just a single request. For that reason it
+ * is highly recommended to fetch all data from fs driver with a single
+ * fs driver request on a background I/O thread (bottom half) in one rush
+ * first and then eventually assembling the final response from that data
+ * on main I/O thread (top half).
*/
#define v9fs_co_run_in_worker(code_block) \
do { \
--
2.20.1
- [PULL 0/7] 9p performance fix for 5.2 2020-08-12, Christian Schoenebeck, 2020/08/12
- [PULL 1/7] tests/virtio-9p: added split readdir tests, Christian Schoenebeck, 2020/08/12
- [PULL 3/7] 9pfs: split out fs driver core of v9fs_co_readdir(), Christian Schoenebeck, 2020/08/12
- [PULL 4/7] 9pfs: add new function v9fs_co_readdir_many(), Christian Schoenebeck, 2020/08/12
- [PULL 2/7] 9pfs: make v9fs_readdir_response_size() public, Christian Schoenebeck, 2020/08/12
- [PULL 7/7] 9pfs: clarify latency of v9fs_co_run_in_worker(),
Christian Schoenebeck <=
- [PULL 5/7] 9pfs: T_readdir latency optimization, Christian Schoenebeck, 2020/08/12
- [PULL 6/7] 9pfs: differentiate readdir lock between 9P2000.u vs. 9P2000.L, Christian Schoenebeck, 2020/08/12
- Re: [PULL 0/7] 9p performance fix for 5.2 2020-08-12, Peter Maydell, 2020/08/24