The percpu-counter-sum code does a for_each_online_cpu() protected by a spinlock, which makes it look like it needs to use get/put_online_cpus_atomic(), going forward. However, the code has adequate synchronization with CPU hotplug, via a hotplug callback and the fbc->lock. So use for_each_online_cpu_nocheck() to avoid false-positive warnings from the hotplug locking validator. And add a comment justifying the same. Cc: Al Viro <viro@xxxxxxxxxxxxxxxxxx> Cc: Tejun Heo <tj@xxxxxxxxxx> Signed-off-by: Srivatsa S. Bhat <srivatsa.bhat@xxxxxxxxxxxxxxxxxx> --- lib/percpu_counter.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/percpu_counter.c b/lib/percpu_counter.c index ba6085d..2d80e8a 100644 --- a/lib/percpu_counter.c +++ b/lib/percpu_counter.c @@ -98,9 +98,16 @@ s64 __percpu_counter_sum(struct percpu_counter *fbc) s64 ret; int cpu; + /* + * CPU hotplug synchronization is explicitly handled via the + * hotplug callback, which synchronizes through fbc->lock. + * So it is safe to use the _nocheck() version of + * for_each_online_cpu() here (to avoid false-positive warnings + * from the CPU hotplug debug code). + */ raw_spin_lock(&fbc->lock); ret = fbc->count; - for_each_online_cpu(cpu) { + for_each_online_cpu_nocheck(cpu) { s32 *pcount = per_cpu_ptr(fbc->counters, cpu); ret += *pcount; } -- To unsubscribe from this list: send the line "unsubscribe linux-arch" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html