From: Pavel Begunkov <[email protected]>
To: Xiaoguang Wang <[email protected]>,
[email protected]
Cc: [email protected], [email protected]
Subject: Re: [PATCH 2/3] io_uring: avoid whole io_wq_work copy for inline requests
Date: Tue, 26 May 2020 18:08:38 +0300 [thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
On 26/05/2020 09:43, Xiaoguang Wang wrote:
> If requests can be submitted inline, we don't need to copy whole
> io_wq_work in io_init_req(), which is an expensive operation. I
> use my io_uring_nop_stress to evaluate performance improvement.
>
> In my physical machine, before this patch:
> $sudo taskset -c 60 ./io_uring_nop_stress -r 120
> total ios: 749093872
> IOPS: 6242448
>
> $sudo taskset -c 60 ./io_uring_nop_stress -r 120
> total ios: 786083712
> IOPS: 6550697
>
> About 4.9% improvement.
Interesting, what's the contribution of fast check in *drop_env() separately
from not zeroing req->work.
>
> Signed-off-by: Xiaoguang Wang <[email protected]>
> ---
> fs/io-wq.h | 13 +++++++++----
> fs/io_uring.c | 33 ++++++++++++++++++++++++++-------
> 2 files changed, 35 insertions(+), 11 deletions(-)
>
> diff --git a/fs/io-wq.h b/fs/io-wq.h
> index 5ba12de7572f..11d981a67006 100644
> --- a/fs/io-wq.h
> +++ b/fs/io-wq.h
> @@ -94,10 +94,15 @@ struct io_wq_work {
> pid_t task_pid;
> };
>
> -#define INIT_IO_WORK(work, _func) \
> - do { \
> - *(work) = (struct io_wq_work){ .func = _func }; \
> - } while (0) \
> +static inline void init_io_work(struct io_wq_work *work,
> + void (*func)(struct io_wq_work **))
> +{
> + if (!work->func)
Not really a good name for a function, which expects some of the fields to be
already initialised, too subtle. Unfortunately, it'll break at some point.
I think, a flag in req->flags for that would be better.
e.g. REQ_F_WORK_INITIALIZED
And it'd be better to somehow separate field of struct io_wq_work,
1. always initialised ones like ->func (and maybe ->creds).
2. lazy initialised controlled by the mentioned flag.
> + *(work) = (struct io_wq_work){ .func = func };
> + else
> + work->func = func;
> +}
> +
>
--
Pavel Begunkov
next prev parent reply other threads:[~2020-05-26 15:09 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-26 6:43 [PATCH 1/3] io_uring: don't use req->work.creds for inline requests Xiaoguang Wang
2020-05-26 6:43 ` [PATCH 2/3] io_uring: avoid whole io_wq_work copy " Xiaoguang Wang
2020-05-26 15:08 ` Pavel Begunkov [this message]
2020-05-26 6:43 ` [PATCH 3/3] io_uring: avoid unnecessary io_wq_work copy for fast poll feature Xiaoguang Wang
2020-05-26 14:33 ` [PATCH 1/3] io_uring: don't use req->work.creds for inline requests Pavel Begunkov
2020-05-26 14:59 ` Xiaoguang Wang
2020-05-26 15:31 ` Pavel Begunkov
2020-05-27 16:41 ` Xiaoguang Wang
2020-05-29 8:16 ` Pavel Begunkov
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 \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
/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