Re: [PATCH 1/3] hotplug: Optimize {get,put}_online_cpus()

From: Peter Zijlstra
Date: Thu Oct 03 2013 - 10:02:36 EST


On Wed, Oct 02, 2013 at 04:56:56PM +0200, Peter Zijlstra wrote:
> + if (atomic_dec_and_test(&cpuhp_waitcount))
> + wake_up(&cpuhp_writer);
> +
> + goto again:
> }

> +
> +#define per_cpu_sum(var) \
> +({ \
> + typeof(var) __sum = 0; \
> + int cpu; \
> + for_each_possible_cpu(cpu) \
> + __sum += per_cpu(var, cpu); \
> + __sum; \
> +)}
>

I just noticed I forgot a refresh..


+++ b/kernel/cpu.c
@@ -120,7 +120,7 @@ void __get_online_cpus(void)
if (atomic_dec_and_test(&cpuhp_waitcount))
wake_up(&cpuhp_writer);

- goto again:
+ goto again;
}
EXPORT_SYMBOL_GPL(__get_online_cpus);

@@ -146,7 +146,7 @@ EXPORT_SYMBOL_GPL(__put_online_cpus);
for_each_possible_cpu(cpu) \
__sum += per_cpu(var, cpu); \
__sum; \
-)}
+})

/*
* See srcu_readers_active_idx_check() for a rather more detailed explanation.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/