linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] blk-mq: use array manage hctx map instead of xarray
@ 2025-11-27  1:39 Fengnan Chang
  2025-11-27  1:39 ` [PATCH v2 1/2] " Fengnan Chang
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: Fengnan Chang @ 2025-11-27  1:39 UTC (permalink / raw)
  To: axboe, linux-block, ming.lei, hare, hch, yukuai3; +Cc: Fengnan Chang

From: Fengnan Chang <changfengnan@bytedance.com>

After commit 4e5cc99e1e48 ("blk-mq: manage hctx map via xarray"), we use
an xarray instead of array to store hctx, but in poll mode, each time
in blk_mq_poll, we need use xa_load to find corresponding hctx, this
introduce some costs. In my test, xa_load may cost 3.8% cpu.

After revert previous change, eliminates the overhead of xa_load and can
result in a 3% performance improvement.

potentital use-after-free on q->queue_hw_ctx can be fixed by use rcu to
avoid, same as Yu Kuai did in [1].

[1] https://lore.kernel.org/all/20220225072053.2472431-1-yukuai3@huawei.com/

Fengnan Chang (2):
  blk-mq: use array manage hctx map instead of xarray
  blk-mq: fix potential uaf for 'queue_hw_ctx'

 block/blk-mq-tag.c     |  2 +-
 block/blk-mq.c         | 63 ++++++++++++++++++++++++++++--------------
 block/blk-mq.h         | 13 ++++++++-
 include/linux/blk-mq.h |  3 +-
 include/linux/blkdev.h |  2 +-
 5 files changed, 58 insertions(+), 25 deletions(-)


base-commit: 4941a17751c99e17422be743c02c923ad706f888
-- 
2.39.5 (Apple Git-154)


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2025-11-27 23:33 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-27  1:39 [PATCH v2 0/2] blk-mq: use array manage hctx map instead of xarray Fengnan Chang
2025-11-27  1:39 ` [PATCH v2 1/2] " Fengnan Chang
2025-11-27  1:39 ` [PATCH v2 2/2] blk-mq: fix potential uaf for 'queue_hw_ctx' Fengnan Chang
2025-11-27  3:33   ` Ming Lei
2025-11-27  3:38     ` Ming Lei
2025-11-27 18:46   ` kernel test robot
2025-11-27 20:30   ` kernel test robot
2025-11-27 20:41   ` kernel test robot
2025-11-27 23:32   ` kernel test robot
2025-11-27  2:47 ` [PATCH v2 0/2] blk-mq: use array manage hctx map instead of xarray Jens Axboe
2025-11-27  2:55   ` fengnan chang
2025-11-27  2:49 ` Jens Axboe
2025-11-27  3:00   ` fengnan chang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).