From: Jens Axboe <axboe@kernel.dk>
To: Fengnan Chang <changfengnan@bytedance.com>,
xiaobing.li@samsung.com, asml.silence@gmail.com,
io-uring@vger.kernel.org
Cc: Diangang Li <lidiangang@bytedance.com>
Subject: Re: [PATCH v2] io_uring: add IORING_SETUP_SQTHREAD_STATS flag to enable sqthread stats collection
Date: Mon, 20 Oct 2025 09:12:35 -0600 [thread overview]
Message-ID: <8ac97b77-4423-41cf-a1f3-99d93ac65f9d@kernel.dk> (raw)
In-Reply-To: <20251020113031.2135-1-changfengnan@bytedance.com>
On 10/20/25 5:30 AM, Fengnan Chang wrote:
> In previous versions, getrusage was always called in sqrthread
> to count work time, but this could incur some overhead.
> This patch turn off stats by default, and introduces a new flag
> IORING_SETUP_SQTHREAD_STATS that allows user to enable the
> collection of statistics in the sqthread.
>
> ./t/io_uring -p1 -d128 -b4096 -s32 -c1 -F1 -B1 -R1 -X1 -n1 ./testfile
> IOPS base: 570K, patch: 590K
>
> ./t/io_uring -p1 -d128 -b4096 -s32 -c1 -F1 -B1 -R1 -X1 -n1 /dev/nvme1n1
> IOPS base: 826K, patch: 889K
That's a crazy amount of overhead indeed. I'm assuming this is
because the task has lots of threads? And/or going through the retry
a lot? Might make more sense to have a cheaper and more rough
getrusage() instead? All we really use is ru_stime.{tv_sec,tv_nsec}.
Should it be using RUSAGE_THREAD? Correct me if I'm wrong, but using
PTHREAD_SELF actually seems wrong as-is.
In any case, I don't think a setup flag is the right choice here. That
space is fairly limited, and SQPOLL is also a bit of an esoteric
feature. Hence not sure a setup flag is the right approach. Would
probably make more sense to have a REGISTER opcode to get/set various
features like this, I'm sure it's not the last thing like this we'll run
into. But as mentioned, I do think just having a more light weight
getrusage would perhaps be prudent.
--
Jens Axboe
next prev parent reply other threads:[~2025-10-20 15:12 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-20 11:30 [PATCH v2] io_uring: add IORING_SETUP_SQTHREAD_STATS flag to enable sqthread stats collection Fengnan Chang
2025-10-20 14:59 ` Gabriel Krisman Bertazi
2025-10-21 8:50 ` [External] " Fengnan Chang
2025-10-20 15:12 ` Jens Axboe [this message]
2025-10-21 8:54 ` Fengnan Chang
2025-10-21 17:54 ` Jens Axboe
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=8ac97b77-4423-41cf-a1f3-99d93ac65f9d@kernel.dk \
--to=axboe@kernel.dk \
--cc=asml.silence@gmail.com \
--cc=changfengnan@bytedance.com \
--cc=io-uring@vger.kernel.org \
--cc=lidiangang@bytedance.com \
--cc=xiaobing.li@samsung.com \
/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