The patch titled Subject: mm/slub.c: switch to bitmap_zalloc() has been added to the -mm tree. Its filename is mm-slubc-switch-to-bitmap_zalloc.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/mm-slubc-switch-to-bitmap_zalloc.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/mm-slubc-switch-to-bitmap_zalloc.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx> Subject: mm/slub.c: switch to bitmap_zalloc() Switch to bitmap_zalloc() to show clearly what we are allocating. Besides that it returns pointer of bitmap type instead of opaque void *. Link: http://lkml.kernel.org/r/20180830104301.61649-1-andriy.shevchenko@xxxxxxxxxxxxxxx Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx> Acked-by: Christoph Lameter <cl@xxxxxxxxx> Reviewed-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> Cc: Pekka Enberg <penberg@xxxxxxxxxx> Cc: David Rientjes <rientjes@xxxxxxxxxx> Cc: Joonsoo Kim <iamjoonsoo.kim@xxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- diff -puN mm/slub.c~mm-slubc-switch-to-bitmap_zalloc mm/slub.c --- a/mm/slub.c~mm-slubc-switch-to-bitmap_zalloc +++ a/mm/slub.c @@ -3622,9 +3622,7 @@ static void list_slab_objects(struct kme #ifdef CONFIG_SLUB_DEBUG void *addr = page_address(page); void *p; - unsigned long *map = kcalloc(BITS_TO_LONGS(page->objects), - sizeof(long), - GFP_ATOMIC); + unsigned long *map = bitmap_zalloc(page->objects, GFP_ATOMIC); if (!map) return; slab_err(s, page, text, s->name); @@ -3639,7 +3637,7 @@ static void list_slab_objects(struct kme } } slab_unlock(page); - kfree(map); + bitmap_free(map); #endif } @@ -4412,10 +4410,8 @@ static long validate_slab_cache(struct k { int node; unsigned long count = 0; - unsigned long *map = kmalloc_array(BITS_TO_LONGS(oo_objects(s->max)), - sizeof(unsigned long), - GFP_KERNEL); struct kmem_cache_node *n; + unsigned long *map = bitmap_alloc(oo_objects(s->max), GFP_KERNEL); if (!map) return -ENOMEM; @@ -4423,7 +4419,7 @@ static long validate_slab_cache(struct k flush_all(s); for_each_kmem_cache_node(s, node, n) count += validate_slab_node(s, n, map); - kfree(map); + bitmap_free(map); return count; } /* @@ -4574,14 +4570,12 @@ static int list_locations(struct kmem_ca unsigned long i; struct loc_track t = { 0, 0, NULL }; int node; - unsigned long *map = kmalloc_array(BITS_TO_LONGS(oo_objects(s->max)), - sizeof(unsigned long), - GFP_KERNEL); struct kmem_cache_node *n; + unsigned long *map = bitmap_alloc(oo_objects(s->max), GFP_KERNEL); if (!map || !alloc_loc_track(&t, PAGE_SIZE / sizeof(struct location), GFP_KERNEL)) { - kfree(map); + bitmap_free(map); return sprintf(buf, "Out of memory\n"); } /* Push back cpu slabs */ @@ -4647,7 +4641,7 @@ static int list_locations(struct kmem_ca } free_loc_track(&t); - kfree(map); + bitmap_free(map); if (!t.count) len += sprintf(buf, "No data\n"); return len; _ Patches currently in -mm which might be from andriy.shevchenko@xxxxxxxxxxxxxxx are mm-slubc-switch-to-bitmap_zalloc.patch