LCOV - code coverage report
Current view: top level - block - blk-mq-cpumap.c (source / functions) Hit Total Coverage
Test: coverage.info Lines: 0 12 0.0 %
Date: 2023-03-27 20:00:47 Functions: 0 2 0.0 %

          Line data    Source code
       1             : // SPDX-License-Identifier: GPL-2.0
       2             : /*
       3             :  * CPU <-> hardware queue mapping helpers
       4             :  *
       5             :  * Copyright (C) 2013-2014 Jens Axboe
       6             :  */
       7             : #include <linux/kernel.h>
       8             : #include <linux/threads.h>
       9             : #include <linux/module.h>
      10             : #include <linux/mm.h>
      11             : #include <linux/smp.h>
      12             : #include <linux/cpu.h>
      13             : #include <linux/group_cpus.h>
      14             : 
      15             : #include <linux/blk-mq.h>
      16             : #include "blk.h"
      17             : #include "blk-mq.h"
      18             : 
      19           0 : void blk_mq_map_queues(struct blk_mq_queue_map *qmap)
      20             : {
      21             :         const struct cpumask *masks;
      22             :         unsigned int queue, cpu;
      23             : 
      24           0 :         masks = group_cpus_evenly(qmap->nr_queues);
      25           0 :         if (!masks) {
      26           0 :                 for_each_possible_cpu(cpu)
      27           0 :                         qmap->mq_map[cpu] = qmap->queue_offset;
      28             :                 return;
      29             :         }
      30             : 
      31           0 :         for (queue = 0; queue < qmap->nr_queues; queue++) {
      32           0 :                 for_each_cpu(cpu, &masks[queue])
      33           0 :                         qmap->mq_map[cpu] = qmap->queue_offset + queue;
      34             :         }
      35           0 :         kfree(masks);
      36             : }
      37             : EXPORT_SYMBOL_GPL(blk_mq_map_queues);
      38             : 
      39             : /**
      40             :  * blk_mq_hw_queue_to_node - Look up the memory node for a hardware queue index
      41             :  * @qmap: CPU to hardware queue map.
      42             :  * @index: hardware queue index.
      43             :  *
      44             :  * We have no quick way of doing reverse lookups. This is only used at
      45             :  * queue init time, so runtime isn't important.
      46             :  */
      47           0 : int blk_mq_hw_queue_to_node(struct blk_mq_queue_map *qmap, unsigned int index)
      48             : {
      49             :         int i;
      50             : 
      51           0 :         for_each_possible_cpu(i) {
      52           0 :                 if (index == qmap->mq_map[i])
      53             :                         return cpu_to_node(i);
      54             :         }
      55             : 
      56             :         return NUMA_NO_NODE;
      57             : }

Generated by: LCOV version 1.14