From: Christian Schoenebeck <qemu_oss@crudebyte.com>
To: qemu-devel@nongnu.org
Cc: Greg Kurz <groug@kaod.org>
Subject: [PATCH v5 6/6] 9pfs: clarify latency of v9fs_co_run_in_worker()
Date: Thu, 26 Mar 2020 22:25:32 +0100 [thread overview]
Message-ID: <7c4e49a783c7b2f77aa81794892cf08b4feba914.1585258105.git.qemu_oss@crudebyte.com> (raw)
In-Reply-To: <cover.1585258105.git.qemu_oss@crudebyte.com>
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>
---
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 a6851822d5..8b6f76840a 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
prev parent reply other threads:[~2020-03-26 22:29 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-26 21:28 [PATCH v5 0/6] 9pfs: readdir optimization Christian Schoenebeck
2020-03-26 21:24 ` [PATCH v5 1/6] tests/virtio-9p: added split readdir tests Christian Schoenebeck
2020-03-26 21:24 ` [PATCH v5 2/6] 9pfs readdir: rename max_count -> maxsize Christian Schoenebeck
2020-03-26 21:24 ` [PATCH v5 3/6] 9pfs: make v9fs_readdir_response_size() public Christian Schoenebeck
2020-03-26 21:25 ` [PATCH v5 4/6] 9pfs: add new function v9fs_co_readdir_many() Christian Schoenebeck
2020-03-26 21:25 ` [PATCH v5 5/6] 9pfs: T_readdir latency optimization Christian Schoenebeck
2020-03-26 21:25 ` Christian Schoenebeck [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7c4e49a783c7b2f77aa81794892cf08b4feba914.1585258105.git.qemu_oss@crudebyte.com \
--to=qemu_oss@crudebyte.com \
--cc=groug@kaod.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).