> Hi Andrew, hi Chritoph,
>
> On Mon, 7 Jan 2008 11:38:31 -0800, Andrew Morton wrote:
> > On Mon, 7 Jan 2008 10:31:53 -0800 (PST)
> > Christoph Lameter <clameter@sgi.com> wrote:
> >
> > > On Mon, 7 Jan 2008, Andrew Morton wrote:
> > >
> > > > > : undefined reference to `__you_cannot_kmalloc_that_much'
> > >
> > > There is also a kernel.org bugzilla for this at
> > >
> > >
http://bugzilla.kernel.org/show_bug.cgi?id=9669
> > > For some reason my adds to this do not show up.
> > >
> > > In both cases we have a
> > >
> > > k(z/m)alloc(sizeof(*pointer), ...)
> > >
> > > that is for some reason failing. I guess what happens is that the function
> > > in which this occurs is too complex for gcc 3.2. Thus it stops constant
> > > folding the sizeof(*pointer) in the complex inline-if-cascade that SLAB
> > > needs to determine the cache and does not eliminate the
> > > __you_cannot_kmalloc_that_much branch().
>
> Interesting theory... So I tried to split half of the code of
> dmi_id_init() to a subfunction and bingo! gcc 3.2.3 is now able to
> build it properly. Thanks for the hint!
>
> > > SLUB in that case just puts a series of if comparisions in the code. This
> > > means compilation does not fail but a large amount of code is generated.
> >
> > ug. Silent and nasty.
> >
> > > We could replace the __you_cannot_kmalloc_that_much() with a BUG()
> > > statement so we have the same effect in SLAB?
> >
> > I think it'd be better to just put suitable workarounds at the offending
> > callsites. We've only seen three or four of them in several months.
>
> Here's a workaround for dmi-id.
>
> Subject: Fix for __you_cannot_kmalloc_that_much failure in dmi-id
>
> gcc 3.2 has a hard time coping with the code in dmi_id_init():
>
> drivers/built-in.o(.init.text+0x789e): In function `dmi_id_init':
> : undefined reference to `__you_cannot_kmalloc_that_much'
> make: *** [.tmp_vmlinux1] Error 1
>
> Moving half of the code to a separate function seems to help. This is
> a no-op for gcc 4.1 which will successfully inline the code anyway.