2011-03-28 17:41:08

by Sisir Koppaka

[permalink] [raw]
Subject: [PATCH] block: Replace NR_CPUS with num_online_cpus()

NR_CPUS is a boot state and hence, not indicative of the actual number
of online CPUs. This is a known checkpatch warning.

Signed-off-by: Sisir Koppaka <[email protected]>
CC: Jens Axboe <[email protected]>
CC: Tejun Heo <[email protected]>
---
block/blk.h | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/block/blk.h b/block/blk.h
index c8db371..9a55515 100644
--- a/block/blk.h
+++ b/block/blk.h
@@ -1,3 +1,4 @@
+#include <linux/cpumask.h>
#ifndef BLK_INTERNAL_H
#define BLK_INTERNAL_H

@@ -136,7 +137,7 @@ static inline int
queue_congestion_off_threshold(struct request_queue *q)

static inline int blk_cpu_to_group(int cpu)
{
- int group = NR_CPUS;
+ int group = num_online_cpus();
#ifdef CONFIG_SCHED_MC
const struct cpumask *mask = cpu_coregroup_mask(cpu);
group = cpumask_first(mask);
@@ -145,7 +146,7 @@ static inline int blk_cpu_to_group(int cpu)
#else
return cpu;
#endif
- if (likely(group < NR_CPUS))
+ if (likely(group < num_online_cpus()))
return group;
return cpu;
}
--
1.7.0.4

? ? ? ? ? ? ? ? sk