Lines Matching +full:cpu +full:- +full:map

1 // SPDX-License-Identifier: GPL-2.0
3 * CPU <-> hardware queue mapping helpers
5 * Copyright (C) 2013-2014 Jens Axboe
12 #include <linux/cpu.h>
14 #include <linux/blk-mq.h>
16 #include "blk-mq.h"
21 return qmap->queue_offset + (q % nr_queues); in queue_index()
24 static int get_first_sibling(unsigned int cpu) in get_first_sibling() argument
28 ret = cpumask_first(topology_sibling_cpumask(cpu)); in get_first_sibling()
32 return cpu; in get_first_sibling()
37 unsigned int *map = qmap->mq_map; in blk_mq_map_queues() local
38 unsigned int nr_queues = qmap->nr_queues; in blk_mq_map_queues()
39 unsigned int cpu, first_sibling, q = 0; in blk_mq_map_queues() local
41 for_each_possible_cpu(cpu) in blk_mq_map_queues()
42 map[cpu] = -1; in blk_mq_map_queues()
46 * count of dead queues which are mapped by all un-present CPUs in blk_mq_map_queues()
48 for_each_present_cpu(cpu) { in blk_mq_map_queues()
51 map[cpu] = queue_index(qmap, nr_queues, q++); in blk_mq_map_queues()
54 for_each_possible_cpu(cpu) { in blk_mq_map_queues()
55 if (map[cpu] != -1) in blk_mq_map_queues()
59 * In case we still have CPUs to map, and we have some number of in blk_mq_map_queues()
60 * threads per cores then map sibling threads to the same queue in blk_mq_map_queues()
64 map[cpu] = queue_index(qmap, nr_queues, q++); in blk_mq_map_queues()
66 first_sibling = get_first_sibling(cpu); in blk_mq_map_queues()
67 if (first_sibling == cpu) in blk_mq_map_queues()
68 map[cpu] = queue_index(qmap, nr_queues, q++); in blk_mq_map_queues()
70 map[cpu] = map[first_sibling]; in blk_mq_map_queues()
77 * blk_mq_hw_queue_to_node - Look up the memory node for a hardware queue index
78 * @qmap: CPU to hardware queue map.
89 if (index == qmap->mq_map[i]) in blk_mq_hw_queue_to_node()