Re: PROBLEM: Off-by-one bug on sun4u SMP

From: David Miller
Date: Fri Jun 11 2010 - 01:26:23 EST

From: Ryan Davis <iconoclasmandheresy@xxxxxxxxx>
Date: Thu, 10 Jun 2010 21:01:28 -0700

> OK... so there are no kernel data structures allocated for CPU #0
> which is not present? It is my understanding that this is not the case
> but I could be wrong. If this is true, then a chunk of kernel memory
> is wasted tor the phantom CPU #0.

There are two cases.

1) There are certain arrays which we have to allocate before we know
how many physical cpus will be present. There are therefore
CONFIG_NR_CPUS of these elements allocated statically in the
kernel image.

These cases are extremely few and constantly decreasing over time
as we find ways to remove these cases.

2) Everything else is only allocated for cpus actually present.

Frankly, I often run with CONFIG_NR_CPUS=2048 or some crazy value like
that and the memory wasted by static data structures is very small.

> A quick search was unable to find documentation on this quirk. Perhaps
> you could point me at some?

Feel free to write a patch which adds that documentation.
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