lkml.org 
[lkml]   [2012]   [Feb]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] lib/cpumask.c: Optimize __any_online_cpu() calculation
Date
__any_online_cpu() uses a for loop at the moment.
Instead, use cpumask_* operations to speed it up.

Signed-off-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
---
Actually, the patch posted at https://lkml.org/lkml/2012/2/15/101 removed
the last user of any_online_cpu() (and hence __any_online_cpu()).
However, since this is an exported symbol, I refrained from removing this
function altogether.
lib/cpumask.c | 8 +-------
1 files changed, 1 insertions(+), 7 deletions(-)
diff --git a/lib/cpumask.c b/lib/cpumask.c
index af3e5817..b25f53d 100644
--- a/lib/cpumask.c
+++ b/lib/cpumask.c
@@ -28,13 +28,7 @@ EXPORT_SYMBOL(__next_cpu_nr);

int __any_online_cpu(const cpumask_t *mask)
{
- int cpu;
-
- for_each_cpu(cpu, mask) {
- if (cpu_online(cpu))
- break;
- }
- return cpu;
+ return cpumask_any_and(mask, cpu_online_mask);
}
EXPORT_SYMBOL(__any_online_cpu);



\
 
 \ /
  Last update: 2012-02-15 13:37    [from the cache]
©2003-2011 Jasper Spaans