All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pavel Begunkov <asml.silence@gmail.com>
To: Jens Axboe <axboe@kernel.dk>, io-uring@vger.kernel.org
Cc: krisman@suse.de
Subject: Re: [PATCH 2/2] io_uring: get rid of alloc cache init_once handling
Date: Thu, 23 Jan 2025 14:27:49 +0000	[thread overview]
Message-ID: <cebeb4b6-0604-43cb-b916-e03ee79cf713@gmail.com> (raw)
In-Reply-To: <20250123142301.409846-3-axboe@kernel.dk>

On 1/23/25 14:21, Jens Axboe wrote:
> init_once is called when an object doesn't come from the cache, and
> hence needs initial clearing of certain members. While the whole
> struct could get cleared by memset() in that case, a few of the cache
> members are large enough that this may cause unnecessary overhead if
> the caches used aren't large enough to satisfy the workload. For those
> cases, some churn of kmalloc+kfree is to be expected.
> 
> Ensure that the 3 users that need clearing put the members they need
> cleared at the start of the struct, and place an empty placeholder
> 'init' member so that the cache initialization knows how much to
> clear.
> 
> Signed-off-by: Jens Axboe <axboe@kernel.dk>
> ---
>   include/linux/io_uring/cmd.h   |  3 ++-
>   include/linux/io_uring_types.h |  3 ++-
>   io_uring/alloc_cache.h         | 30 +++++++++++++++++++++---------
>   io_uring/futex.c               |  4 ++--
>   io_uring/io_uring.c            | 13 ++++++++-----
>   io_uring/io_uring.h            |  5 ++---
>   io_uring/net.c                 | 11 +----------
>   io_uring/net.h                 |  7 +++++--
>   io_uring/poll.c                |  2 +-
>   io_uring/rw.c                  | 10 +---------
>   io_uring/rw.h                  |  5 ++++-
>   io_uring/uring_cmd.c           | 10 +---------
>   12 files changed, 50 insertions(+), 53 deletions(-)
> 
> diff --git a/include/linux/io_uring/cmd.h b/include/linux/io_uring/cmd.h
> index a3ce553413de..8d7746d9fd23 100644
> --- a/include/linux/io_uring/cmd.h
> +++ b/include/linux/io_uring/cmd.h
> @@ -19,8 +19,9 @@ struct io_uring_cmd {
>   };
>   
>   struct io_uring_cmd_data {
> -	struct io_uring_sqe	sqes[2];
>   	void			*op_data;
> +	int			init[0];

What do you think about using struct_group instead?

-- 
Pavel Begunkov


  reply	other threads:[~2025-01-23 14:27 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-23 14:21 [PATCHSET 0/2] Cleanup alloc cache init_once handling Jens Axboe
2025-01-23 14:21 ` [PATCH 1/2] io_uring/uring_cmd: cleanup struct io_uring_cmd_data layout Jens Axboe
2025-01-23 14:38   ` Pavel Begunkov
2025-01-23 14:54     ` Jens Axboe
2025-01-23 14:57       ` Pavel Begunkov
2025-01-23 14:58         ` Jens Axboe
2025-01-23 14:21 ` [PATCH 2/2] io_uring: get rid of alloc cache init_once handling Jens Axboe
2025-01-23 14:27   ` Pavel Begunkov [this message]
2025-01-23 14:47     ` Pavel Begunkov
2025-01-23 14:55       ` Jens Axboe
2025-01-23 15:05         ` Pavel Begunkov
2025-01-23 15:09           ` Jens Axboe
2025-01-23 14:54     ` 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=cebeb4b6-0604-43cb-b916-e03ee79cf713@gmail.com \
    --to=asml.silence@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=io-uring@vger.kernel.org \
    --cc=krisman@suse.de \
    /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.