Skip to content

Commit

Permalink
blk-mq: Avoid memoryless numa node encoded in hctx numa_node
Browse files Browse the repository at this point in the history
In architecture like powerpc, we can have cpus without any local memory
attached to it (a.k.a memoryless nodes). In such cases cpu to node mapping
can result in memory allocation hints for block hctx->numa_node populated
with node values which does not have real memory.

Instead use local_memory_node(), which is guaranteed to have memory.
local_memory_node is a noop in other architectures that does not support
memoryless nodes.

Signed-off-by: Raghavendra K T <raghavendra.kt@linux.vnet.ibm.com>
Reviewed-by: Sagi Grimberg <sagig@mellanox.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
  • Loading branch information
Raghavendra K T authored and Jens Axboe committed Dec 3, 2015
1 parent e0e827b commit bffed45
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion block/blk-mq-cpumap.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ int blk_mq_hw_queue_to_node(unsigned int *mq_map, unsigned int index)

for_each_possible_cpu(i) {
if (index == mq_map[i])
return cpu_to_node(i);
return local_memory_node(cpu_to_node(i));
}

return NUMA_NO_NODE;
Expand Down
2 changes: 1 addition & 1 deletion block/blk-mq.c
Original file line number Diff line number Diff line change
Expand Up @@ -1790,7 +1790,7 @@ static void blk_mq_init_cpu_queues(struct request_queue *q,
* not, we remain on the home node of the device
*/
if (nr_hw_queues > 1 && hctx->numa_node == NUMA_NO_NODE)
hctx->numa_node = cpu_to_node(i);
hctx->numa_node = local_memory_node(cpu_to_node(i));
}
}

Expand Down

0 comments on commit bffed45

Please sign in to comment.