From: Ming Lei <ming.lei@redhat.com>
To: Caleb Sander Mateos <csander@purestorage.com>
Cc: Jens Axboe <axboe@kernel.dk>,
linux-block@vger.kernel.org,
Uday Shankar <ushankar@purestorage.com>,
Keith Busch <kbusch@kernel.org>
Subject: Re: [PATCH V2 2/2] ublk selftests: add --no_ublk_fixed_fd for not using registered ublk char device
Date: Tue, 26 Aug 2025 16:36:43 +0800 [thread overview]
Message-ID: <aK1yG6mfYfkRKI3Z@fedora> (raw)
In-Reply-To: <CADUfDZrZLiD9r7AK+83HLgi-tXGvzNX_fasvwQ2_-wm6EVPifQ@mail.gmail.com>
On Mon, Aug 25, 2025 at 09:53:27PM -0700, Caleb Sander Mateos wrote:
> On Mon, Aug 25, 2025 at 5:49 AM Ming Lei <ming.lei@redhat.com> wrote:
> >
> > Add a new command line option --no_ublk_fixed_fd that excludes the ublk
> > control device (/dev/ublkcN) from io_uring's registered files array.
> > When this option is used, only backing files are registered starting
> > from index 1, while the ublk control device is accessed using its raw
> > file descriptor.
> >
> > Add ublk_get_registered_fd() helper function that returns the appropriate
> > file descriptor for use with io_uring operations, taking ublk_queue *
> > parameter instead of ublk_thread * for better performance.
> >
> > Key optimizations implemented:
> > - Cache UBLKS_Q_NO_UBLK_FIXED_FD flag in ublk_queue.flags to avoid
> > reading dev->no_ublk_fixed_fd in fast path
> > - Cache ublk char device fd in ublk_queue.ublk_fd for fast access
> > - Update ublk_get_registered_fd() to use ublk_queue * parameter
> > - Update io_uring_prep_buf_register/unregister() to use ublk_queue *
> > - Replace ublk_device * access with ublk_queue * access in fast paths
> >
> > This improves performance by:
> > - Eliminating device structure traversal in hot paths
> > - Better cache locality with queue-local data access
> > - Reduced indirection for flag and fd lookups
>
> Are you saying that performance is better when using the raw
> /dev/ublkcN fd instead of an io_uring registered file? That would be
> really surprising to me, since the whole point of io_uring file
> registration is to avoid the file reference counting in the I/O path.
No, here it just describes one implementation detail by caching per-device
flag(no_ublk_fixed_fd) in queue's flag.
The test can trigger hang with patch V1 by passing --no_ublk_fixed_fd
because /dev/ublkcN and io_uring closes can be depended, both are run
from task work context in current task.
Thanks,
Ming
prev parent reply other threads:[~2025-08-26 8:36 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-25 12:48 [PATCH V2 0/2] ublk: avoid ublk_io_release() called after ublk char dev is closed Ming Lei
2025-08-25 12:48 ` [PATCH V2 1/2] " Ming Lei
2025-08-26 5:49 ` Caleb Sander Mateos
2025-08-26 8:32 ` Ming Lei
2025-08-29 15:37 ` Caleb Sander Mateos
2025-09-01 8:44 ` Ming Lei
2025-08-25 12:48 ` [PATCH V2 2/2] ublk selftests: add --no_ublk_fixed_fd for not using registered ublk char device Ming Lei
2025-08-26 4:53 ` Caleb Sander Mateos
2025-08-26 8:36 ` Ming Lei [this message]
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=aK1yG6mfYfkRKI3Z@fedora \
--to=ming.lei@redhat.com \
--cc=axboe@kernel.dk \
--cc=csander@purestorage.com \
--cc=kbusch@kernel.org \
--cc=linux-block@vger.kernel.org \
--cc=ushankar@purestorage.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 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.