public inbox for [email protected]
 help / color / mirror / Atom feed
From: Jens Axboe <[email protected]>
To: Xiaoguang Wang <[email protected]>,
	[email protected]
Cc: [email protected]
Subject: Re: [PATCH] io_uring: io_uring_enter(2) don't poll while SETUP_IOPOLL|SETUP_SQPOLL enabled
Date: Wed, 11 Mar 2020 07:06:05 -0600	[thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>

On 3/10/20 7:26 PM, Xiaoguang Wang wrote:
> When SETUP_IOPOLL and SETUP_SQPOLL are both enabled, applications don't need
> to do io completion events polling again, they can rely on io_sq_thread to do
> polling work, which can reduce cpu usage and uring_lock contention.
> 
> I modify fio io_uring engine codes a bit to evaluate the performance:
> static int fio_ioring_getevents(struct thread_data *td, unsigned int min,
>                         continue;
>                 }
> 
> -               if (!o->sqpoll_thread) {
> +               if (o->sqpoll_thread && o->hipri) {
>                         r = io_uring_enter(ld, 0, actual_min,
>                                                 IORING_ENTER_GETEVENTS);
>                         if (r < 0) {
> 
> and use "fio  -name=fiotest -filename=/dev/nvme0n1 -iodepth=$depth -thread
> -rw=read -ioengine=io_uring  -hipri=1 -sqthread_poll=1  -direct=1 -bs=4k
> -size=10G -numjobs=1  -time_based -runtime=120"
> 
> original codes
> --------------------------------------------------------------------
> iodepth       |        4 |        8 |       16 |       32 |       64
> bw            | 1133MB/s | 1519MB/s | 2090MB/s | 2710MB/s | 3012MB/s
> fio cpu usage |     100% |     100% |     100% |     100% |     100%
> --------------------------------------------------------------------
> 
> with patch
> --------------------------------------------------------------------
> iodepth       |        4 |        8 |       16 |       32 |       64
> bw            | 1196MB/s | 1721MB/s | 2351MB/s | 2977MB/s | 3357MB/s
> fio cpu usage |    63.8% |   74.4%% |    81.1% |    83.7% |    82.4%
> --------------------------------------------------------------------
> bw improve    |     5.5% |    13.2% |    12.3% |     9.8% |    11.5%
> --------------------------------------------------------------------
> 
> From above test results, we can see that bw has above 5.5%~13%
> improvement, and fio process's cpu usage also drops much. Note this
> won't improve io_sq_thread's cpu usage when SETUP_IOPOLL|SETUP_SQPOLL
> are both enabled, in this case, io_sq_thread always has 100% cpu usage.
> I think this patch will be friendly to applications which will often use
> io_uring_wait_cqe() or similar from liburing.

I think this looks reasonable, and true to the spirit of how polling
should work when SQPOLL is used. I'll apply this for 5.7, thanks.

-- 
Jens Axboe


      reply	other threads:[~2020-03-11 13:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-11  1:26 [PATCH] io_uring: io_uring_enter(2) don't poll while SETUP_IOPOLL|SETUP_SQPOLL enabled Xiaoguang Wang
2020-03-11 13:06 ` Jens Axboe [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 \
    [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