All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: Usama Arif <usama.arif@bytedance.com>,
	io-uring@vger.kernel.org, asml.silence@gmail.com,
	linux-kernel@vger.kernel.org
Cc: fam.zheng@bytedance.com
Subject: Re: [PATCH v6 0/5] io_uring: remove ring quiesce in io_uring_register
Date: Fri, 4 Feb 2022 08:53:02 -0700	[thread overview]
Message-ID: <b67f1ce6-6110-b6f3-e66e-f636d47a736d@kernel.dk> (raw)
In-Reply-To: <20220204145117.1186568-1-usama.arif@bytedance.com>

On 2/4/22 7:51 AM, Usama Arif wrote:
> Ring quiesce is currently used for registering/unregistering eventfds,
> registering restrictions and enabling rings.
> 
> For opcodes relating to registering/unregistering eventfds, ring quiesce
> can be avoided by creating a new RCU data structure (io_ev_fd) as part
> of io_ring_ctx that holds the eventfd_ctx, with reads to the structure
> protected by rcu_read_lock and writes (register/unregister calls)
> protected by a mutex.
> 
> With the above approach ring quiesce can be avoided which is much more
> expensive then using RCU lock. On the system tested, io_uring_reigster with
> IORING_REGISTER_EVENTFD takes less than 1ms with RCU lock, compared to 15ms
> before with ring quiesce.
> 
> IORING_SETUP_R_DISABLED prevents submitting requests and
> so there will be no requests until IORING_REGISTER_ENABLE_RINGS
> is called. And IORING_REGISTER_RESTRICTIONS works only before
> IORING_REGISTER_ENABLE_RINGS is called. Hence ring quiesce is
> not needed for these opcodes.

I wrote a simple test case just verifying register+unregister, and also
doing a loop to catch any issues around that. Here's the current kernel:

[root@archlinux liburing]# time test/eventfd-reg 

real	0m7.980s
user	0m0.004s
sys	0m0.000s
[root@archlinux liburing]# time test/eventfd-reg 

real	0m8.197s
user	0m0.004s
sys	0m0.000s

which is around ~80ms for each register/unregister cycle, and here are
the results with this patchset:

[root@archlinux liburing]# time test/eventfd-reg

real	0m0.002s
user	0m0.001s
sys	0m0.000s
[root@archlinux liburing]# time test/eventfd-reg

real	0m0.001s
user	0m0.001s
sys	0m0.000s

which looks a lot more reasonable.

I'll look over this one and see if I've got anything to complain about,
just ran it first since I wrote the test anyway. Here's the test case,
btw:

https://git.kernel.dk/cgit/liburing/commit/?id=5bde26e4587168a439cabdbe73740454249e5204

-- 
Jens Axboe


  parent reply	other threads:[~2022-02-04 15:53 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-04 14:51 [PATCH v6 0/5] io_uring: remove ring quiesce in io_uring_register Usama Arif
2022-02-04 14:51 ` [PATCH v6 1/5] io_uring: remove trace for eventfd Usama Arif
2022-02-04 14:51 ` [PATCH v6 2/5] io_uring: avoid ring quiesce while registering/unregistering eventfd Usama Arif
2022-02-04 14:51 ` [PATCH v6 3/5] io_uring: avoid ring quiesce while registering async eventfd Usama Arif
2022-02-04 14:51 ` [PATCH v6 4/5] io_uring: avoid ring quiesce while registering restrictions and enabling rings Usama Arif
2022-02-04 14:51 ` [PATCH v6 5/5] io_uring: remove ring quiesce for io_uring_register Usama Arif
2022-07-15 15:44   ` Michal Koutný
2022-07-15 16:00     ` Jens Axboe
2022-07-15 17:45       ` [PATCH] io_uring: Don't require reinitable percpu_ref Michal Koutný
2022-07-15 17:54         ` Roman Gushchin
2022-07-15 18:22         ` Jens Axboe
2022-02-04 15:53 ` Jens Axboe [this message]
2022-02-04 16:19 ` [PATCH v6 0/5] io_uring: remove ring quiesce in io_uring_register 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=b67f1ce6-6110-b6f3-e66e-f636d47a736d@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=asml.silence@gmail.com \
    --cc=fam.zheng@bytedance.com \
    --cc=io-uring@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=usama.arif@bytedance.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.