diff options
Diffstat (limited to 'block/blk.h')
-rw-r--r-- | block/blk.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/block/blk.h b/block/blk.h index a09c18b..faf94f2 100644 --- a/block/blk.h +++ b/block/blk.h @@ -148,14 +148,18 @@ static inline int queue_congestion_off_threshold(struct request_queue *q) static inline int blk_cpu_to_group(int cpu) { + int group = NR_CPUS; #ifdef CONFIG_SCHED_MC const struct cpumask *mask = cpu_coregroup_mask(cpu); - return cpumask_first(mask); + group = cpumask_first(mask); #elif defined(CONFIG_SCHED_SMT) - return cpumask_first(topology_thread_cpumask(cpu)); + group = cpumask_first(topology_thread_cpumask(cpu)); #else return cpu; #endif + if (likely(group < NR_CPUS)) + return group; + return cpu; } /* |