public inbox for [email protected]
 help / color / mirror / Atom feed
From: Pavel Begunkov <[email protected]>
To: Jens Axboe <[email protected]>, [email protected]
Cc: [email protected]
Subject: Re: [PATCH 2/6] io_uring: move poll_refs up a cacheline to fill a hole
Date: Thu, 20 Apr 2023 01:50:01 +0100	[thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>

On 4/19/23 17:25, Jens Axboe wrote:
> After bumping the flags to 64-bits, we now have two holes in io_kiocb.
> The best candidate for moving is poll_refs, as not to split the task_work
> related items.
> 
> Signed-off-by: Jens Axboe <[email protected]>
> ---
>   include/linux/io_uring_types.h | 6 ++++--
>   1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/include/linux/io_uring_types.h b/include/linux/io_uring_types.h
> index 84f436cc6509..4dd54d2173e1 100644
> --- a/include/linux/io_uring_types.h
> +++ b/include/linux/io_uring_types.h
> @@ -535,6 +535,9 @@ struct io_kiocb {
>   	 * and after selection it points to the buffer ID itself.
>   	 */
>   	u16				buf_index;
> +
> +	atomic_t			poll_refs;

poll wake is often done by a random CPU, would be great to limit
cache sharing, i.e. the 2nd cache line is never touched by
io_poll_wake() and it'd only need the poll entry and
the 3rd line with io_task_work().

There is one place that doesn't care about it, i.e.
clearing REQ_F_[SINGLE,DOUBLE]_POLL in poll wake, but
it's a place to improve.


> +
>   	u64				flags;
>   
>   	struct io_cqe			cqe;
> @@ -565,9 +568,8 @@ struct io_kiocb {
>   		__poll_t apoll_events;
>   	};
>   	atomic_t			refs;
> -	atomic_t			poll_refs;
> -	struct io_task_work		io_task_work;
>   	unsigned			nr_tw;
> +	struct io_task_work		io_task_work;
>   	/* for polled requests, i.e. IORING_OP_POLL_ADD and async armed poll */
>   	union {
>   		struct hlist_node	hash_node;

-- 
Pavel Begunkov

  reply	other threads:[~2023-04-20  0:52 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-19 16:25 [PATCHSET 0/6] Enable NO_OFFLOAD support Jens Axboe
2023-04-19 16:25 ` [PATCH 1/6] io_uring: grow struct io_kiocb 'flags' to a 64-bit value Jens Axboe
2023-04-19 16:25 ` [PATCH 2/6] io_uring: move poll_refs up a cacheline to fill a hole Jens Axboe
2023-04-20  0:50   ` Pavel Begunkov [this message]
2023-04-19 16:25 ` [PATCH 3/6] io_uring: add support for NO_OFFLOAD Jens Axboe
2023-04-20  1:01   ` Pavel Begunkov
2023-04-20 15:03     ` Jens Axboe
2023-04-20 15:16       ` Pavel Begunkov
2023-04-20 15:56         ` Jens Axboe
2023-04-19 16:25 ` [PATCH 4/6] Revert "io_uring: always go async for unsupported fadvise flags" Jens Axboe
2023-04-19 16:25 ` [PATCH 5/6] Revert "io_uring: for requests that require async, force it" Jens Axboe
2023-04-19 16:25 ` [PATCH 6/6] io_uring: mark opcodes that always need io-wq punt Jens Axboe
2023-04-20  0:43 ` [PATCHSET 0/6] Enable NO_OFFLOAD support Pavel Begunkov
2023-04-20 15:08   ` Jens Axboe
2023-04-20 15:28     ` 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] \
    [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