From: Jens Axboe <[email protected]>
To: Pavel Begunkov <[email protected]>, [email protected]
Subject: Re: [RFC v2 09/13] io_uring: separate wq for ring polling
Date: Wed, 4 Jan 2023 13:52:03 -0700 [thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
On 1/4/23 1:34?PM, Jens Axboe wrote:
> On 1/4/23 1:28?PM, Pavel Begunkov wrote:
>> On 1/4/23 18:08, Jens Axboe wrote:
>>> On 1/2/23 8:04?PM, Pavel Begunkov wrote:
>>>> Don't use ->cq_wait for ring polling but add a separate wait queue for
>>>> it. We need it for following patches.
>>>>
>>>> Signed-off-by: Pavel Begunkov <[email protected]>
>>>> ---
>>>> include/linux/io_uring_types.h | 1 +
>>>> io_uring/io_uring.c | 3 ++-
>>>> io_uring/io_uring.h | 9 +++++++++
>>>> 3 files changed, 12 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/include/linux/io_uring_types.h b/include/linux/io_uring_types.h
>>>> index dcd8a563ab52..cbcd3aaddd9d 100644
>>>> --- a/include/linux/io_uring_types.h
>>>> +++ b/include/linux/io_uring_types.h
>>>> @@ -286,6 +286,7 @@ struct io_ring_ctx {
>>>> unsigned cq_entries;
>>>> struct io_ev_fd __rcu *io_ev_fd;
>>>> struct wait_queue_head cq_wait;
>>>> + struct wait_queue_head poll_wq;
>>>> unsigned cq_extra;
>>>> } ____cacheline_aligned_in_smp;
>>>>
>>>
>>> Should we move poll_wq somewhere else, more out of the way?
>>
>> If we care about polling perf and cache collisions with
>> cq_wait, yeah we can. In any case it's a good idea to at
>> least move it after cq_extra.
>>
>>> Would need to gate the check a flag or something.
>>
>> Not sure I follow
>
> I guess I could've been a bit more verbose... If we consider poll on the
> io_uring rather uncommon, then moving the poll_wq outside of the hotter
> cq_wait cacheline(s) would make sense. Each wait_queue_head is more than
> a cacheline. Then we could have a flag in a spot that's hot anyway
> whether to check it or not, eg in that same section as cq_wait.
>
> Looking at the layout right now, we're at 116 bytes for that section, or
> two cachelines with 12 bytes to spare. If we add poll_wq, then we'll be
> at 196 bytes, which is 4 bytes over the next cacheline. So it'd
> essentially double the size of that section. If we moved it outside of
> the aligned sections, then it'd pack better.
Just after writing this, I noticed that a spinlock took 64 bytes... In
other words, I have LOCKDEP enabled. The correct number is 24 bytes for
wait_queue_head which is obviously a lot more reasonable. It'd still
make that section one more cacheline since it's now at 60 bytes and
would grow to 84 bytes. But it's obviously not as big of a problem as I
had originally assumed.
--
Jens Axboe
next prev parent reply other threads:[~2023-01-04 20:52 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-03 3:03 [RFC v2 00/13] CQ waiting and wake up optimisations Pavel Begunkov
2023-01-03 3:03 ` [RFC v2 01/13] io_uring: rearrange defer list checks Pavel Begunkov
2023-01-03 3:03 ` [RFC v2 02/13] io_uring: don't iterate cq wait fast path Pavel Begunkov
2023-01-03 3:03 ` [RFC v2 03/13] io_uring: kill io_run_task_work_ctx Pavel Begunkov
2023-01-03 3:03 ` [RFC v2 04/13] io_uring: move defer tw task checks Pavel Begunkov
2023-01-03 3:03 ` [RFC v2 05/13] io_uring: parse check_cq out of wq waiting Pavel Begunkov
2023-01-03 3:03 ` [RFC v2 06/13] io_uring: mimimise io_cqring_wait_schedule Pavel Begunkov
2023-01-03 3:03 ` [RFC v2 07/13] io_uring: simplify io_has_work Pavel Begunkov
2023-01-03 3:03 ` [RFC v2 08/13] io_uring: set TASK_RUNNING right after schedule Pavel Begunkov
2023-01-03 3:04 ` [RFC v2 09/13] io_uring: separate wq for ring polling Pavel Begunkov
2023-01-04 18:08 ` Jens Axboe
2023-01-04 20:28 ` Pavel Begunkov
2023-01-04 20:34 ` Jens Axboe
2023-01-04 20:45 ` Pavel Begunkov
2023-01-04 20:53 ` Jens Axboe
2023-01-04 20:52 ` Jens Axboe [this message]
2023-01-03 3:04 ` [RFC v2 10/13] io_uring: add lazy poll_wq activation Pavel Begunkov
2023-01-03 3:04 ` [RFC v2 11/13] io_uring: wake up optimisations Pavel Begunkov
2023-01-03 3:04 ` [RFC v2 12/13] io_uring: waitqueue-less cq waiting Pavel Begunkov
2023-01-03 3:04 ` [RFC v2 13/13] io_uring: add io_req_local_work_add wake fast path Pavel Begunkov
2023-01-04 18:05 ` (subset) [RFC v2 00/13] CQ waiting and wake up optimisations Jens Axboe
2023-01-04 20:25 ` 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] \
/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