cregit-Linux how code gets into the kernel

Release 4.14 block/blk-mq-cpumap.c

Directory: block
/*
 * CPU <-> hardware queue mapping helpers
 *
 * Copyright (C) 2013-2014 Jens Axboe
 */
#include <linux/kernel.h>
#include <linux/threads.h>
#include <linux/module.h>
#include <linux/mm.h>
#include <linux/smp.h>
#include <linux/cpu.h>

#include <linux/blk-mq.h>
#include "blk.h"
#include "blk-mq.h"


static int cpu_to_queue_index(unsigned int nr_queues, const int cpu) { /* * Non present CPU will be mapped to queue index 0. */ if (!cpu_present(cpu)) return 0; return cpu % nr_queues; }

Contributors

PersonTokensPropCommitsCommitProp
Jens Axboe1858.06%133.33%
Max Gurtovoy1135.48%133.33%
Christoph Hellwig26.45%133.33%
Total31100.00%3100.00%


static int get_first_sibling(unsigned int cpu) { unsigned int ret; ret = cpumask_first(topology_sibling_cpumask(cpu)); if (ret < nr_cpu_ids) return ret; return cpu; }

Contributors

PersonTokensPropCommitsCommitProp
Jens Axboe3597.22%150.00%
Bartosz Golaszewski12.78%150.00%
Total36100.00%2100.00%


int blk_mq_map_queues(struct blk_mq_tag_set *set) { unsigned int *map = set->mq_map; unsigned int nr_queues = set->nr_hw_queues; unsigned int cpu, first_sibling; for_each_possible_cpu(cpu) { /* * First do sequential mapping between CPUs and queues. * In case we still have CPUs to map, and we have some number of * threads per cores then map sibling threads to the same queue for * performace optimizations. */ if (cpu < nr_queues) { map[cpu] = cpu_to_queue_index(nr_queues, cpu); } else { first_sibling = get_first_sibling(cpu); if (first_sibling == cpu) map[cpu] = cpu_to_queue_index(nr_queues, cpu); else map[cpu] = map[first_sibling]; } } return 0; }

Contributors

PersonTokensPropCommitsCommitProp
Jens Axboe7068.63%133.33%
Christoph Hellwig1716.67%133.33%
Max Gurtovoy1514.71%133.33%
Total102100.00%3100.00%

EXPORT_SYMBOL_GPL(blk_mq_map_queues); /* * We have no quick way of doing reverse lookups. This is only used at * queue init time, so runtime isn't important. */
int blk_mq_hw_queue_to_node(unsigned int *mq_map, unsigned int index) { int i; for_each_possible_cpu(i) { if (index == mq_map[i]) return local_memory_node(cpu_to_node(i)); } return NUMA_NO_NODE; }

Contributors

PersonTokensPropCommitsCommitProp
Jens Axboe4193.18%150.00%
Raghavendra K T36.82%150.00%
Total44100.00%2100.00%


Overall Contributors

PersonTokensPropCommitsCommitProp
Jens Axboe19378.14%333.33%
Max Gurtovoy2610.53%111.11%
Christoph Hellwig249.72%333.33%
Raghavendra K T31.21%111.11%
Bartosz Golaszewski10.40%111.11%
Total247100.00%9100.00%
Directory: block
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.
Created with cregit.