@@ -3621,9 +3621,7 @@ static void list_slab_objects(struct kmem_cache *s, struct page *page,
3621
3621
#ifdef CONFIG_SLUB_DEBUG
3622
3622
void * addr = page_address (page );
3623
3623
void * p ;
3624
- unsigned long * map = kcalloc (BITS_TO_LONGS (page -> objects ),
3625
- sizeof (long ),
3626
- GFP_ATOMIC );
3624
+ unsigned long * map = bitmap_zalloc (page -> objects , GFP_ATOMIC );
3627
3625
if (!map )
3628
3626
return ;
3629
3627
slab_err (s , page , text , s -> name );
@@ -3638,7 +3636,7 @@ static void list_slab_objects(struct kmem_cache *s, struct page *page,
3638
3636
}
3639
3637
}
3640
3638
slab_unlock (page );
3641
- kfree (map );
3639
+ bitmap_free (map );
3642
3640
#endif
3643
3641
}
3644
3642
@@ -4411,18 +4409,16 @@ static long validate_slab_cache(struct kmem_cache *s)
4411
4409
{
4412
4410
int node ;
4413
4411
unsigned long count = 0 ;
4414
- unsigned long * map = kmalloc_array (BITS_TO_LONGS (oo_objects (s -> max )),
4415
- sizeof (unsigned long ),
4416
- GFP_KERNEL );
4417
4412
struct kmem_cache_node * n ;
4413
+ unsigned long * map = bitmap_alloc (oo_objects (s -> max ), GFP_KERNEL );
4418
4414
4419
4415
if (!map )
4420
4416
return - ENOMEM ;
4421
4417
4422
4418
flush_all (s );
4423
4419
for_each_kmem_cache_node (s , node , n )
4424
4420
count += validate_slab_node (s , n , map );
4425
- kfree (map );
4421
+ bitmap_free (map );
4426
4422
return count ;
4427
4423
}
4428
4424
/*
@@ -4573,14 +4569,12 @@ static int list_locations(struct kmem_cache *s, char *buf,
4573
4569
unsigned long i ;
4574
4570
struct loc_track t = { 0 , 0 , NULL };
4575
4571
int node ;
4576
- unsigned long * map = kmalloc_array (BITS_TO_LONGS (oo_objects (s -> max )),
4577
- sizeof (unsigned long ),
4578
- GFP_KERNEL );
4579
4572
struct kmem_cache_node * n ;
4573
+ unsigned long * map = bitmap_alloc (oo_objects (s -> max ), GFP_KERNEL );
4580
4574
4581
4575
if (!map || !alloc_loc_track (& t , PAGE_SIZE / sizeof (struct location ),
4582
4576
GFP_KERNEL )) {
4583
- kfree (map );
4577
+ bitmap_free (map );
4584
4578
return sprintf (buf , "Out of memory\n" );
4585
4579
}
4586
4580
/* Push back cpu slabs */
@@ -4646,7 +4640,7 @@ static int list_locations(struct kmem_cache *s, char *buf,
4646
4640
}
4647
4641
4648
4642
free_loc_track (& t );
4649
- kfree (map );
4643
+ bitmap_free (map );
4650
4644
if (!t .count )
4651
4645
len += sprintf (buf , "No data\n" );
4652
4646
return len ;
0 commit comments