Linux io-uring development
 help / color / mirror / Atom feed
From: Pavel Begunkov <asml.silence@gmail.com>
To: Keith Busch <kbusch@meta.com>,
	ming.lei@redhat.com, axboe@kernel.dk,
	linux-block@vger.kernel.org, io-uring@vger.kernel.org
Cc: bernd@bsbernd.com, csander@purestorage.com,
	Keith Busch <kbusch@kernel.org>
Subject: Re: [PATCHv4 5/5] io_uring: cache nodes and mapped buffers
Date: Thu, 20 Feb 2025 11:08:25 +0000	[thread overview]
Message-ID: <d2889d14-27d2-4a64-b8d1-ff0e4af6d552@gmail.com> (raw)
In-Reply-To: <20250218224229.837848-6-kbusch@meta.com>

On 2/18/25 22:42, Keith Busch wrote:
> From: Keith Busch <kbusch@kernel.org>
> 
> Frequent alloc/free cycles on these is pretty costly. Use an io cache to
> more efficiently reuse these buffers.
> 
> Signed-off-by: Keith Busch <kbusch@kernel.org>
> ---
>   include/linux/io_uring_types.h |  18 ++---
>   io_uring/filetable.c           |   2 +-
>   io_uring/rsrc.c                | 120 +++++++++++++++++++++++++--------
>   io_uring/rsrc.h                |   2 +-
>   4 files changed, 104 insertions(+), 38 deletions(-)
> 
> diff --git a/include/linux/io_uring_types.h b/include/linux/io_uring_types.h
> index 810d1dccd27b1..bbfb651506522 100644
> --- a/include/linux/io_uring_types.h
> +++ b/include/linux/io_uring_types.h
> @@ -69,8 +69,18 @@ struct io_file_table {
>   	unsigned int alloc_hint;
...
> -struct io_rsrc_node *io_rsrc_node_alloc(int type)
> +struct io_rsrc_node *io_rsrc_node_alloc(struct io_ring_ctx *ctx, int type)
>   {
>   	struct io_rsrc_node *node;
>   
> -	node = kzalloc(sizeof(*node), GFP_KERNEL);
> +	if (type == IORING_RSRC_FILE)
> +		node = kmalloc(sizeof(*node), GFP_KERNEL);
> +	else
> +		node = io_cache_alloc(&ctx->buf_table.node_cache, GFP_KERNEL);

That's why node allocators shouldn't be a part of the buffer table.

-- 
Pavel Begunkov


  parent reply	other threads:[~2025-02-20 11:07 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-18 22:42 [PATCHv4 0/5] ublk zero-copy support Keith Busch
2025-02-18 22:42 ` [PATCHv4 1/5] io_uring: move fixed buffer import to issue path Keith Busch
2025-02-19  1:27   ` Caleb Sander Mateos
2025-02-19  4:23   ` Ming Lei
2025-02-19 16:48   ` Pavel Begunkov
2025-02-19 17:15     ` Pavel Begunkov
2025-02-20  1:25     ` Keith Busch
2025-02-20 10:12       ` Pavel Begunkov
2025-02-18 22:42 ` [PATCHv4 2/5] io_uring: add support for kernel registered bvecs Keith Busch
2025-02-19  1:54   ` Caleb Sander Mateos
2025-02-19 17:23     ` Pavel Begunkov
2025-02-20 10:31     ` Pavel Begunkov
2025-02-20 10:38   ` Pavel Begunkov
2025-02-18 22:42 ` [PATCHv4 3/5] ublk: zc register/unregister bvec Keith Busch
2025-02-19  2:36   ` Caleb Sander Mateos
2025-02-20 11:11   ` Pavel Begunkov
2025-02-24 21:02     ` Keith Busch
2025-02-18 22:42 ` [PATCHv4 4/5] io_uring: add abstraction for buf_table rsrc data Keith Busch
2025-02-19  3:04   ` Caleb Sander Mateos
2025-02-18 22:42 ` [PATCHv4 5/5] io_uring: cache nodes and mapped buffers Keith Busch
2025-02-19  4:22   ` Caleb Sander Mateos
2025-02-24 21:01     ` Keith Busch
2025-02-24 21:39       ` Caleb Sander Mateos
2025-02-20 11:08   ` Pavel Begunkov [this message]
2025-02-20 15:24     ` Keith Busch
2025-02-20 16:06       ` Pavel Begunkov
2025-02-24 21:04         ` Keith Busch
2025-02-25 13:06           ` 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 \
    --in-reply-to=d2889d14-27d2-4a64-b8d1-ff0e4af6d552@gmail.com \
    --to=asml.silence@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=bernd@bsbernd.com \
    --cc=csander@purestorage.com \
    --cc=io-uring@vger.kernel.org \
    --cc=kbusch@kernel.org \
    --cc=kbusch@meta.com \
    --cc=linux-block@vger.kernel.org \
    --cc=ming.lei@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox