Re: [PATCH] percpu data: only iterate over possible CPUs

From: Chuck Ebbert
Date: Thu Feb 09 2006 - 03:39:46 EST


In-Reply-To: <20060208204502.12513ae5.akpm@xxxxxxxx>

On Wed, 8 Feb 2006 at 20:45:02 -0800, Andrew Morton wrote:

> > Its even documented in line 332 of include/linux/cpumask.h
> >
> > * #ifdef CONFIG_HOTPLUG_CPU
> > * cpu_possible_map - all NR_CPUS bits set
>
> That seems a quite bad idea. If we know which CPUs are possible we should
> populate cpu_possible_map correctly, whether or not CONFIG_HOTPLUG_CPU is
> set.

I don't think that's, um, "possible." Even if you could discover how many
empty sockets there were in a system, someone might be able to hotplug
a board with more of them on it. And there's no way to tell how many CPUs
to reserve for each socket anyway, e.g. AMD has already announced quad-core
processors.

But what really surprised me is that for_each_cpu() actually walks
cpu_possible_map and not cpu_present_map as I had assumed. This violates
the Principle Of Least Surprise. Maybe renaming for_each_cpu to
for_each_possible_cpu might be a good idea?

--
Chuck
"Equations are the Devil's sentences." --Stephen Colbert

-
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/