On Sat, May 19, 2012 at 7:32 PM, David Rientjes <[email protected]> wrote: > > Why wasn't this caught by gfp_allowed_mask in slab_pre_alloc_hook()? > GFP_KERNEL should be allowed in this context.
We set gfp_allowed_mask to allow all allocations before this point: it
happens when we enable interrupts fairly early during start_kernel().
So by the time pidmap_init() is called, GFP_KERNEL does imply that
scheduling can happen.
Which does imply that we set gfp_allowed_mask *much* too early. We
still cannot schedule at that point (well, at least there's a comment
saying so):
/*
* Disable preemption - early bootup scheduling is extremely
* fragile until we cpu_idle() for the first time.
*/
preempt_disable();
so logically we should move the gfp_allowed_mask setting down to where
we really are properly alive.
How about moving it down to after we've done the full smp_init() and
after we've actually done the first schedule and have proper idle
CPU's?
Something like the attached (UNTESTED!) patch?
Linus
patch.diff
Description: Binary data
