2016-10-27 06:26:59

by Xiubo Li

[permalink] [raw]
Subject: [PATCH] blk-mq: remove the double hctx->numa_node init code.

Since the commit f14bbe77a96bb ("blk-mq: pass in suggested NUMA
node to ->alloc_hctx()") has already computed and set the
suggested NUMA node for hctx, so this code here is reduntant.

Signed-off-by: Xiubo Li <[email protected]>
---
block/blk-mq.c | 19 ++-----------------
1 file changed, 2 insertions(+), 17 deletions(-)

diff --git a/block/blk-mq.c b/block/blk-mq.c
index 4c0622f..ab86716 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -1767,33 +1767,18 @@ static int blk_mq_init_hw_queues(struct request_queue *q,
return 1;
}

-static void blk_mq_init_cpu_queues(struct request_queue *q,
- unsigned int nr_hw_queues)
+static void blk_mq_init_cpu_queues(struct request_queue *q)
{
unsigned int i;

for_each_possible_cpu(i) {
struct blk_mq_ctx *__ctx = per_cpu_ptr(q->queue_ctx, i);
- struct blk_mq_hw_ctx *hctx;

memset(__ctx, 0, sizeof(*__ctx));
__ctx->cpu = i;
spin_lock_init(&__ctx->lock);
INIT_LIST_HEAD(&__ctx->rq_list);
__ctx->queue = q;
-
- /* If the cpu isn't online, the cpu is mapped to first hctx */
- if (!cpu_online(i))
- continue;
-
- hctx = q->mq_ops->map_queue(q, i);
-
- /*
- * Set local node, IFF we have more than one hw queue. If
- * not, we remain on the home node of the device
- */
- if (nr_hw_queues > 1 && hctx->numa_node == NUMA_NO_NODE)
- hctx->numa_node = local_memory_node(cpu_to_node(i));
}
}

@@ -2046,7 +2031,7 @@ struct request_queue *blk_mq_init_allocated_queue(struct blk_mq_tag_set *set,
if (set->ops->complete)
blk_queue_softirq_done(q, set->ops->complete);

- blk_mq_init_cpu_queues(q, set->nr_hw_queues);
+ blk_mq_init_cpu_queues(q);

if (blk_mq_init_hw_queues(q, set))
goto err_hctxs;
--
1.8.3.1