On Thu, Jan 07, 2016 at 03:03:53PM +0100, Jesper Dangaard Brouer wrote: > Dedublicate code in SLAB allocator functions slab_alloc() and > slab_alloc_node() by using the slab_pre_alloc_hook() call, which > is now shared between SLUB and SLAB. > > Signed-off-by: Jesper Dangaard Brouer <brouer@xxxxxxxxxx> > --- > mm/slab.c | 18 ++++-------------- > 1 file changed, 4 insertions(+), 14 deletions(-) > > diff --git a/mm/slab.c b/mm/slab.c > index d5b29e7bee81..17fd6268ad41 100644 > --- a/mm/slab.c > +++ b/mm/slab.c > @@ -3140,15 +3140,10 @@ slab_alloc_node(struct kmem_cache *cachep, gfp_t flags, int nodeid, > void *ptr; > int slab_node = numa_mem_id(); > > - flags &= gfp_allowed_mask; > - > - lockdep_trace_alloc(flags); > - > - if (should_failslab(cachep, flags)) > + cachep = slab_pre_alloc_hook(cachep, flags); > + if (!cachep) > return NULL; How about adding unlikely here? > > - cachep = memcg_kmem_get_cache(cachep, flags); > - > cache_alloc_debugcheck_before(cachep, flags); > local_irq_save(save_flags); > > @@ -3228,15 +3223,10 @@ slab_alloc(struct kmem_cache *cachep, gfp_t flags, unsigned long caller) > unsigned long save_flags; > void *objp; > > - flags &= gfp_allowed_mask; > - > - lockdep_trace_alloc(flags); > - > - if (should_failslab(cachep, flags)) > + cachep = slab_pre_alloc_hook(cachep, flags); > + if (!cachep) > return NULL; Dito. Thanks. -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>