]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
ublk: don't access ublk_queue in ublk_config_io_buf()
authorCaleb Sander Mateos <csander@purestorage.com>
Thu, 18 Sep 2025 01:49:48 +0000 (19:49 -0600)
committerJens Axboe <axboe@kernel.dk>
Sat, 20 Sep 2025 12:36:27 +0000 (06:36 -0600)
For ublk servers with many ublk queues, accessing the ublk_queue in
ublk_config_io_buf() is a frequent cache miss. Get the flags
from the ublk_device instead, which is accessed earlier in
ublk_ch_uring_cmd_local().

Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/block/ublk_drv.c

index 9c6045e6d03bf8cedceee827bba3b700a2ba6cf7..9535382f9f8e7883ef3feb542afc660fad3913c6 100644 (file)
@@ -2081,11 +2081,11 @@ ublk_fill_io_cmd(struct ublk_io *io, struct io_uring_cmd *cmd)
 }
 
 static inline int
-ublk_config_io_buf(const struct ublk_queue *ubq, struct ublk_io *io,
+ublk_config_io_buf(const struct ublk_device *ub, struct ublk_io *io,
                   struct io_uring_cmd *cmd, unsigned long buf_addr,
                   u16 *buf_idx)
 {
-       if (ublk_support_auto_buf_reg(ubq))
+       if (ublk_dev_support_auto_buf_reg(ub))
                return ublk_handle_auto_buf_reg(io, cmd, buf_idx);
 
        io->addr = buf_addr;
@@ -2233,7 +2233,7 @@ static int ublk_fetch(struct io_uring_cmd *cmd, struct ublk_queue *ubq,
        WARN_ON_ONCE(io->flags & UBLK_IO_FLAG_OWNED_BY_SRV);
 
        ublk_fill_io_cmd(io, cmd);
-       ret = ublk_config_io_buf(ubq, io, cmd, buf_addr, NULL);
+       ret = ublk_config_io_buf(ub, io, cmd, buf_addr, NULL);
        if (ret)
                goto out;
 
@@ -2387,7 +2387,7 @@ static int ublk_ch_uring_cmd_local(struct io_uring_cmd *cmd,
                        goto out;
                io->res = result;
                req = ublk_fill_io_cmd(io, cmd);
-               ret = ublk_config_io_buf(ubq, io, cmd, addr, &buf_idx);
+               ret = ublk_config_io_buf(ub, io, cmd, addr, &buf_idx);
                compl = ublk_need_complete_req(ubq, io);
 
                /* can't touch 'ublk_io' any more */
@@ -2408,7 +2408,7 @@ static int ublk_ch_uring_cmd_local(struct io_uring_cmd *cmd,
                 * request
                 */
                req = ublk_fill_io_cmd(io, cmd);
-               ret = ublk_config_io_buf(ubq, io, cmd, addr, NULL);
+               ret = ublk_config_io_buf(ub, io, cmd, addr, NULL);
                WARN_ON_ONCE(ret);
                if (likely(ublk_get_data(ubq, io, req))) {
                        __ublk_prep_compl_io_cmd(io, req);