[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <45a6f8f9-7abf-f513-e872-c346a682e373@gmail.com>
Date: Thu, 20 May 2021 23:46:02 +0100
From: Pavel Begunkov <asml.silence@...il.com>
To: Song Liu <songliubraving@...com>
Cc: "io-uring@...r.kernel.org" <io-uring@...r.kernel.org>,
Networking <netdev@...r.kernel.org>,
"bpf@...r.kernel.org" <bpf@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Jens Axboe <axboe@...nel.dk>,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Andrii Nakryiko <andrii@...nel.org>, Martin Lau <kafai@...com>,
Yonghong Song <yhs@...com>,
John Fastabend <john.fastabend@...il.com>,
KP Singh <kpsingh@...nel.org>,
Horst Schirmeier <horst.schirmeier@...dortmund.de>,
"Franz-B . Tuneke" <franz-bernhard.tuneke@...dortmund.de>,
Christian Dietrich <stettberger@...ucode.de>
Subject: Re: [PATCH 01/23] io_uring: shuffle rarely used ctx fields
On 5/20/21 10:46 PM, Song Liu wrote:
>> On May 19, 2021, at 7:13 AM, Pavel Begunkov <asml.silence@...il.com> wrote:
>> There is a bunch of scattered around ctx fields that are almost never
>> used, e.g. only on ring exit, plunge them to the end, better locality,
>> better aesthetically.
>>
>> Signed-off-by: Pavel Begunkov <asml.silence@...il.com>
>> ---
>> fs/io_uring.c | 36 +++++++++++++++++-------------------
>> 1 file changed, 17 insertions(+), 19 deletions(-)
>>
>> diff --git a/fs/io_uring.c b/fs/io_uring.c
>> index 9ac5e278a91e..7e3410ce100a 100644
>> --- a/fs/io_uring.c
>> +++ b/fs/io_uring.c
>> @@ -367,9 +367,6 @@ struct io_ring_ctx {
>> unsigned cached_cq_overflow;
>> unsigned long sq_check_overflow;
>>
>> - /* hashed buffered write serialization */
>> - struct io_wq_hash *hash_map;
>> -
>> struct list_head defer_list;
>> struct list_head timeout_list;
>> struct list_head cq_overflow_list;
>> @@ -386,9 +383,6 @@ struct io_ring_ctx {
>>
>> struct io_rings *rings;
>>
>> - /* Only used for accounting purposes */
>> - struct mm_struct *mm_account;
>> -
>> const struct cred *sq_creds; /* cred used for __io_sq_thread() */
>> struct io_sq_data *sq_data; /* if using sq thread polling */
>>
>> @@ -409,14 +403,6 @@ struct io_ring_ctx {
>> unsigned nr_user_bufs;
>> struct io_mapped_ubuf **user_bufs;
>>
>> - struct user_struct *user;
>> -
>> - struct completion ref_comp;
>> -
>> -#if defined(CONFIG_UNIX)
>> - struct socket *ring_sock;
>> -#endif
>> -
>> struct xarray io_buffers;
>>
>> struct xarray personalities;
>> @@ -460,12 +446,24 @@ struct io_ring_ctx {
>>
>> struct io_restriction restrictions;
>>
>> - /* exit task_work */
>> - struct callback_head *exit_task_work;
>> -
>> /* Keep this last, we don't need it for the fast path */
>> - struct work_struct exit_work;
>> - struct list_head tctx_list;
>> + struct {
>
> Why do we need an anonymous struct here? For cache line alignment?
> Do we need ____cacheline_aligned_in_smp?
Rather as a visual hint considering that most of the field historically
are in structs (____cacheline_aligned_in_smp). Also preparing to
potentially splitting it out of the ctx struct as it grows big.
First 2-3 patches are not strictly related to bpf and will go separately
earlier, just the set was based on.
>> + #if defined(CONFIG_UNIX)
>> + struct socket *ring_sock;
>> + #endif
>> + /* hashed buffered write serialization */
>> + struct io_wq_hash *hash_map;
>> +
>> + /* Only used for accounting purposes */
>> + struct user_struct *user;
>> + struct mm_struct *mm_account;
>> +
>> + /* ctx exit and cancelation */
>> + struct callback_head *exit_task_work;
>> + struct work_struct exit_work;
>> + struct list_head tctx_list;
>> + struct completion ref_comp;
>> + };
>> };
>>
>> struct io_uring_task {
--
Pavel Begunkov
Powered by blists - more mailing lists