lkml.org 
[lkml]   [2008]   [Feb]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH] [5/8] Fix logic error in 64bit memory hotadd
Date
On Monday 11 February 2008 13:46:25 Ingo Molnar wrote:
>
> * Andi Kleen <ak@suse.de> wrote:
>
> > The memory hotadd code assumes that the pud always exists already, but
> > that might be not true. Allocate it if it isn't there.
>
> ok, this seems an like an ancient memory-hotplug bug.

Yes.

> Does anyone even
> use memory hotplug currently?

I don't know.

> Did you find this bug via review, or did
> it trigger in practice?

Review.

>
> Also, your fix, while it solves a real bug we want to fix, is not quite
> right for upstream integration yet. I can see 3 immediate problems with
> it:
>
> > + if (!pud_present(*pud)) {
> > + pud = (pud_t *)get_zeroed_page(GFP_ATOMIC);
>
> the GFP_ATOMIC here can fail.

The memory hotplug code already uses GFP_ATOMIC elsewhere (spp_getpage)

> The proper solution is to instead extend init_memory_mapping() with a
> gfp_t parameter and pass in GFP_ATOMIC from the early init code (where
> we must not schedule and where GFP_ATOMIC will succeed anyway), but do a
> GFP_KERNEL from arch_add_memory().

The existing code already does GFP_ATOMIC. I admit I haven't double
checked why it does that (didn't read the complete path) but I assume
it takes a spin lock somewhere.

If there is no lock doing a general clean up of all of them would probably
make sense. But it would be orthogonal to my patch and I don't think
it's needed to fix this concrete bug.

The gfp argument is not needed though because this
case can be already distingushed by checking after_bootmem.

> The proper solution is to extend init_memory_mapping() with a return
> value, and to check in the caller. arch_add_memory() obviously does not
> want to panic(), it wants to return -ENOMEM to mm/memory_hotplug.c.

The existing code already panics elsewhere (spp_getpage); i just copied
that.

So in summary the panic&GFP_ATOMIC use are not good (I agree), but it's
not worse than what was in there before.

-Andi


\
 
 \ /
  Last update: 2008-02-11 14:09    [W:0.087 / U:1.228 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site