Re: [patch] Reorganize the cpufreq cpu hotplug locking to not betotally bizare

From: Andrew Morton
Date: Wed Jul 26 2006 - 17:33:00 EST

On Wed, 26 Jul 2006 23:03:06 +0200
Arjan van de Ven <arjan@xxxxxxxxxxxxxxx> wrote:

> I'm really starting to feel that the hotplug lock would have been better
> of being a refcount (with a waitqueue for zero) than a lock. While
> "refcount+waitqueue" sort of IS a lock, the semantics make more sense
> imo...

The mistake in the above paragraph is its use of the term "the hotplug

Think. We don't want to lock CPUs. We don't want to block plug/unplug

What we _do_ want is for subsystems to be able to guarantee the stability
of their per-cpu data and the coherency of that data with cpu_online_map
and cpu_present_map.

We should delete lock_cpu_hotplug() and start again. Perhaps we can do
that post-2.6.18 if we can cobble the current stuff into some semi-working
state. But I doubt if it's very important really - we have heaps of code
in there which is already racy wrt hotplug and adding a little more isn't
likely to hurt.

I count 187 instances of for_each_online_cpu(), and most of them are racy.
There's just no way we can fix all these with lock_cpu_hotplug(). It
simply doesn't have a future.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at