[PATCH 1/2][SRU][xenial] blk-mq: Reuse hardware context cpumask for tags

Eric Desrochers eric.desrochers at canonical.com
Mon Aug 29 20:01:58 UTC 2016


From: Raghavendra K T <raghavendra.kt at linux.vnet.ibm.com>

BugLink: https://bugs.launchpad.net/bugs/1572630

hctx->cpumask is already populated and let the tag cpumask follow that
instead of going through a new for loop.

Signed-off-by: Raghavendra K T <raghavendra.kt at linux.vnet.ibm.com>
Reviewed-by: Sagi Grimberg <sagig at mellanox.com>
Signed-off-by: Jens Axboe <axboe at fb.com>
(cherry picked from commit e0e827b9fc71fbed1a9cd246067c2a4dbd3ea220)
Signed-off-by: Eric Desrochers <eric.desrochers at canonical.com>
---
 block/blk-mq.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/block/blk-mq.c b/block/blk-mq.c
index 4069a0f..32598d2 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -1857,6 +1857,7 @@ static void blk_mq_map_swqueue(struct request_queue *q,
 		hctx->tags = set->tags[i];
 		WARN_ON(!hctx->tags);
 
+		cpumask_copy(hctx->tags->cpumask, hctx->cpumask);
 		/*
 		 * Set the map size to the number of mapped software queues.
 		 * This is more accurate and more efficient than looping
@@ -1870,14 +1871,6 @@ static void blk_mq_map_swqueue(struct request_queue *q,
 		hctx->next_cpu = cpumask_first(hctx->cpumask);
 		hctx->next_cpu_batch = BLK_MQ_CPU_WORK_BATCH;
 	}
-
-	queue_for_each_ctx(q, ctx, i) {
-		if (!cpumask_test_cpu(i, online_mask))
-			continue;
-
-		hctx = q->mq_ops->map_queue(q, i);
-		cpumask_set_cpu(i, hctx->tags->cpumask);
-	}
 }
 
 static void queue_set_hctx_shared(struct request_queue *q, bool shared)
-- 
2.7.4





More information about the kernel-team mailing list