blk-mq: use array manage hctx map instead of xarray
Status from this message: Applied, thanks!
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v3 Latest2 patches 6 repliesApplied
- v22 patches 6 repliesSuperseded
- v12 patches 5 repliesSuperseded
Changes in v3 from the cover letter
fix build error and part sparse warnings, not all sparse warnings, because the queue is freezed in __blk_mq_update_nr_hw_queues, only need protect 'queue_hw_ctx' through rcu where it can be accessed without grabbing 'q_usage_counter'.
Patches in v3 Applied
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | blk-mq: use array manage hctx map instead of xarrayblock/ block/ block/ +2 more | +42 | 0 replies | |
| 2/2 | blk-mq: fix potential uaf for 'queue_hw_ctx'block/ include/ include/ | +19 | 2 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v3 yet.
Cover letter [PATCH v3 0/2] blk-mq: use array manage hctx map instead of xarray
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/[email protected]/
v3:
fix build error and part sparse warnings, not all sparse warnings, because the queue is freezed in __blk_mq_update_nr_hw_queues, only need protect 'queue_hw_ctx' through rcu where it can be accessed without grabbing 'q_usage_counter'.
v2:
1. modify synchronize_rcu() to synchronize_rcu_expedited()
2. use rcu_dereference(q->queue_hw_ctx)[id] in queue_hctx to better read.
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 | 2 +- include/linux/blk-mq.h | 14 +++++++++- include/linux/blkdev.h | 2 +- 5 files changed, 58 insertions(+), 25 deletions(-)
base-commit: 4941a17751c99e17422be743c02c923ad706f888
Signature · 1 line
2.39.5 (Apple Git-154)