From 6e623f3f1a976a90ddca5c358a8eb26f3985a99a Mon Sep 17 00:00:00 2001 From: John Garry Date: Wed, 2 Nov 2022 15:36:32 +0800 Subject: [PATCH] blk-mq: Don't clear driver tags own mapping mainline inclusion from mainline-v5.16-rc1 commit 4f245d5bf0f7432c881e22a77066160a6cba8e03 category: performance bugzilla: 186917, https://gitee.com/openeuler/kernel/issues/I5N1S5 CVE: NA Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=4f245d5bf0f7432c881e22a77066160a6cba8e03 -------------------------------- Function blk_mq_clear_rq_mapping() is required to clear the sched tags mappings in driver tags rqs[]. But there is no need for a driver tags to clear its own mapping, so skip clearing the mapping in this scenario. Signed-off-by: John Garry Reviewed-by: Hannes Reinecke Reviewed-by: Ming Lei Link: https://lore.kernel.org/r/1633429419-228500-9-git-send-email-john.garry@huawei.com Signed-off-by: Jens Axboe Signed-off-by: Yu Kuai Reviewed-by: Yu Kuai Reviewed-by: Jason Yan Signed-off-by: Zheng Zengkai --- block/blk-mq.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/block/blk-mq.c b/block/blk-mq.c index c564f8b0120b..fdaf3284a676 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -2438,6 +2438,10 @@ static void blk_mq_clear_rq_mapping(struct blk_mq_tags *drv_tags, struct page *page; unsigned long flags; + /* There is no need to clear a driver tags own mapping */ + if (drv_tags == tags) + return; + list_for_each_entry(page, &tags->page_list, lru) { unsigned long start = (unsigned long)page_address(page); unsigned long end = start + order_to_size(page->private); -- GitLab