Skip to content

Commit 23c0144

Browse files
calebsanderaxboe
authored andcommitted
ublk: don't access ublk_queue in ublk_config_io_buf()
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 <[email protected]> Reviewed-by: Ming Lei <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent a689efd commit 23c0144

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

drivers/block/ublk_drv.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2081,11 +2081,11 @@ ublk_fill_io_cmd(struct ublk_io *io, struct io_uring_cmd *cmd)
20812081
}
20822082

20832083
static inline int
2084-
ublk_config_io_buf(const struct ublk_queue *ubq, struct ublk_io *io,
2084+
ublk_config_io_buf(const struct ublk_device *ub, struct ublk_io *io,
20852085
struct io_uring_cmd *cmd, unsigned long buf_addr,
20862086
u16 *buf_idx)
20872087
{
2088-
if (ublk_support_auto_buf_reg(ubq))
2088+
if (ublk_dev_support_auto_buf_reg(ub))
20892089
return ublk_handle_auto_buf_reg(io, cmd, buf_idx);
20902090

20912091
io->addr = buf_addr;
@@ -2233,7 +2233,7 @@ static int ublk_fetch(struct io_uring_cmd *cmd, struct ublk_queue *ubq,
22332233
WARN_ON_ONCE(io->flags & UBLK_IO_FLAG_OWNED_BY_SRV);
22342234

22352235
ublk_fill_io_cmd(io, cmd);
2236-
ret = ublk_config_io_buf(ubq, io, cmd, buf_addr, NULL);
2236+
ret = ublk_config_io_buf(ub, io, cmd, buf_addr, NULL);
22372237
if (ret)
22382238
goto out;
22392239

@@ -2387,7 +2387,7 @@ static int ublk_ch_uring_cmd_local(struct io_uring_cmd *cmd,
23872387
goto out;
23882388
io->res = result;
23892389
req = ublk_fill_io_cmd(io, cmd);
2390-
ret = ublk_config_io_buf(ubq, io, cmd, addr, &buf_idx);
2390+
ret = ublk_config_io_buf(ub, io, cmd, addr, &buf_idx);
23912391
compl = ublk_need_complete_req(ubq, io);
23922392

23932393
/* can't touch 'ublk_io' any more */
@@ -2408,7 +2408,7 @@ static int ublk_ch_uring_cmd_local(struct io_uring_cmd *cmd,
24082408
* request
24092409
*/
24102410
req = ublk_fill_io_cmd(io, cmd);
2411-
ret = ublk_config_io_buf(ubq, io, cmd, addr, NULL);
2411+
ret = ublk_config_io_buf(ub, io, cmd, addr, NULL);
24122412
WARN_ON_ONCE(ret);
24132413
if (likely(ublk_get_data(ubq, io, req))) {
24142414
__ublk_prep_compl_io_cmd(io, req);

0 commit comments

Comments
 (0)