public inbox for io-uring@vger.kernel.org
 help / color / mirror / Atom feed
From: Fengnan Chang <changfengnan@bytedance.com>
To: Jens Axboe <axboe@kernel.dk>
Cc: xiaobing.li@samsung.com, asml.silence@gmail.com,
	io-uring@vger.kernel.org,  Diangang Li <lidiangang@bytedance.com>
Subject: Re: [External] Re: [PATCH v2] io_uring: add IORING_SETUP_SQTHREAD_STATS flag to enable sqthread stats collection
Date: Tue, 21 Oct 2025 16:54:39 +0800	[thread overview]
Message-ID: <CAPFOzZswzJMSdtpZZTTWQ0b3SUgPg5g1cFLVQTQh+os_tVzSnw@mail.gmail.com> (raw)
In-Reply-To: <8ac97b77-4423-41cf-a1f3-99d93ac65f9d@kernel.dk>

Jens Axboe <axboe@kernel.dk> 于2025年10月20日周一 23:12写道:
>
> 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.

Only one sqpoll thread, no retry.  Only enable sq_thread_poll by default in
 ./t/io_uring.c to test.
Yeh, getrusage is not correct, I'll try to find a cheaper way.

>
> 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.
Get your point,  I'll make it in REGISTER opcode.
>
> --
> Jens Axboe

  reply	other threads:[~2025-10-21  8:54 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
2025-10-21  8:54   ` Fengnan Chang [this message]
2025-10-21 17:54     ` [External] " 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=CAPFOzZswzJMSdtpZZTTWQ0b3SUgPg5g1cFLVQTQh+os_tVzSnw@mail.gmail.com \
    --to=changfengnan@bytedance.com \
    --cc=asml.silence@gmail.com \
    --cc=axboe@kernel.dk \
    --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