Re: for_each_online_cpu broken ?

From: Andi Kleen
Date: Thu Dec 08 2005 - 01:12:16 EST


On Wed, Dec 07, 2005 at 09:38:25PM -0800, David S. Miller wrote:
> From: Dave Jones <davej@xxxxxxxxxx>
> Date: Thu, 8 Dec 2005 00:33:02 -0500
>
> > On Thu, Dec 08, 2005 at 06:26:32AM +0100, Andi Kleen wrote:
> >
> > > The possible map is fixed kind of BTW in 2.6.15rc*. It was a side effect
> > > of CPU hotplug, which now uses a better algorithm to guess the
> > > number of possible CPUs. In 2.6.15 you will just get half the number
> > > of available CPUs in addition by default
> >
> > Yep, I noticed it offers a maximum of 6 cpus on my way.
> > As a sidenote, seems kinda funny (and wasteful maybe?), doing this
> > on a lot of hardware that isn't hotplug capable. (Whilst I could
> > disable cpu hotplug in my local build, this isn't an answer for
> > a generic distro kernel).

If you can figure out a way to detect this please share.
The ACPI designers unfortunately didn't think that far
(they did it right for memory hotplug, but not for CPU)

I invented an ACPI extensin for it, but it's non standard
so the half of CPUs is used as a default unless overwritten
(additional_cpus=NUM)

Anyways I changed it earlier to 1 additional CPU by default.

>
> This can be dangerous btw, as some subsystem such as netfilter
> allocate enormous datastructures based upon the largest possible
> cpu number in the system.

It is a big improvement in fact. Previously with NR_CPUS==128
(default on some distros) and CPU_HOTPLUG enabled it would
always allocate several hundred KB of just standard
per cpu data unnecessarily.

-Andi

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