Re: slub: remove dynamic dma slab allocation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 21 Jun 2010, Christoph Lameter wrote:

> > > You cannot do that here because this function is also used later when the
> > > slab is up. There is more in the percpu allocator which we are also trying
> > > to use to avoid having static kmem_cache_cpu declarations. GFP_KERNEL
> > > needs to be usable during early boot otherwise functions will have to add
> > > special casing for boot situations.
> > >
> >
> > The gfp_allowed_mask only changes once irqs are enabled, so either the
> > gfpflags need to be passed into init_kmem_cache_nodes again or we need to
> > do something like
> >
> > 	gfp_t gfpflags = irqs_disabled() ? GFP_NOWAIT : GFP_KERNEL;
> >
> > locally.
> 
> What a mess....
> 
> > The cleanest solution would probably be to extend slab_state to be set in
> > kmem_cache_init_late() to determine when we're fully initialized, though.
> 
> Not sure what the point would be. Changing slab_state does not change the
> interrupt enabled/disabled state of the processor.
> 

If you added an even higher slab_state level than UP and set it in 
kmem_cache_init_late(), then you could check for it to determine 
GFP_NOWAIT or GFP_KERNEL in init_kmem_cache_nodes() rather than 
irqs_disabled() because that's the only real event that requires 
kmem_cache_init_late() to need to exist in the first place.

I'm not sure if you'd ever use that state again, but it's robust if 
anything is ever added in the space between kmem_cache_init() and 
kmem_cache_init_late() for a reason.  slab_is_available() certainly 
doesn't need it because we don't kmem_cache_create() in between the two.

When you consider those solutions, it doesn't appear as though removing 
the gfp_t formal in init_kmem_cache_nodes() is really that much of a 
cleanup.

> Is gfp_allowed_mask properly updated during boot? Then we could just use
> 
> 	GFP_KERNEL & gfp_allowed_mask
> 
> in these locations? Still bad since we are wasting code on correctness
> checks.
> 

That certainly does get us GFP_NOWAIT (same as GFP_BOOT_MASK) before irqs 
are enabled and GFP_KERNEL afterwards since gfp_allowed_mask is updated at 
the same time.  If it's worth getting of the gfp_t formal in 
init_kmem_cache_nodes() so much, then that masking would deserve a big fat 
comment :)

> Noone thought about this when designing these checks? The checks cannot be
> fixed up to consider boot time so that we do not have to do artistics in
> the code?
> 

I think gfp_allowed_mask is the intended solution since it simply masks 
off GFP_KERNEL and turns those allocations into GFP_BOOT_MASK before it 
gets updated.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxxx  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]