[<prev] [next>] [day] [month] [year] [list]
Message-ID: <AANLkTikVjknc32PiZ2O4jb+JUgwffhULyxRxFUCOS+bv@mail.gmail.com>
Date: Mon, 28 Mar 2011 23:09:53 +0530
From: Sisir Koppaka <sisir.koppaka@...il.com>
To: Jens Axboe <jaxboe@...ionio.com>, Tejun Heo <tj@...nel.org>,
linux-kernel@...r.kernel.org
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 <sisir.koppaka@...il.com>
CC: Jens Axboe <jaxboe@...ionio.com>
CC: Tejun Heo <tj@...nel.org>
---
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists