Messages in this thread Patch in this message |  | | | From | "Srivatsa S. Bhat" <> | | Subject | [PATCH] lib/cpumask.c: Optimize __any_online_cpu() calculation | | Date | Wed, 15 Feb 2012 18:05:14 +0530 |
| |
__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);
|  |