From: Liam R. Howlett Date: Thu, 19 Nov 2020 17:15:39 +0000 (-0500) Subject: testing: radix-tree changes cleanup X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=788ce19058221a2e0e86aacdf8ccf76d88cacdcc;p=users%2Fjedix%2Flinux-maple.git testing: radix-tree changes cleanup Signed-off-by: Liam R. Howlett --- diff --git a/tools/testing/radix-tree/linux.c b/tools/testing/radix-tree/linux.c index f7fc20fff919..ab8ea12f00d6 100644 --- a/tools/testing/radix-tree/linux.c +++ b/tools/testing/radix-tree/linux.c @@ -97,14 +97,15 @@ void kmem_cache_free_bulk(struct kmem_cache *cachep, size_t size, void **list) { if (kmalloc_verbose) printk("Bulk free %p[0-%lu]\n", list, size - 1); - for (int i = 0; i < size; i++) { + + for (int i = 0; i < size; i++) kmem_cache_free(cachep, list[i]); - } } int kmem_cache_alloc_bulk(struct kmem_cache *cachep, gfp_t gfp, size_t size, void **p) { size_t i; + if (kmalloc_verbose) printk("Bulk alloc %lu\n", size); @@ -112,11 +113,12 @@ int kmem_cache_alloc_bulk(struct kmem_cache *cachep, gfp_t gfp, size_t size, return 0; if (!(gfp & __GFP_DIRECT_RECLAIM)) - cachep->non_kernel-= size; + cachep->non_kernel -= size; pthread_mutex_lock(&cachep->lock); if (cachep->nr_objs >= size) { struct radix_tree_node *node = cachep->objs; + for (i = 0; i < size; i++) { cachep->nr_objs--; cachep->objs = node->parent; diff --git a/tools/testing/radix-tree/linux/maple_tree.h b/tools/testing/radix-tree/linux/maple_tree.h index 529b19bd47b6..993ac3c3026f 100644 --- a/tools/testing/radix-tree/linux/maple_tree.h +++ b/tools/testing/radix-tree/linux/maple_tree.h @@ -1,2 +1,3 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ #include "../../../../include/linux/maple_tree.h" #define U8_MAX UCHAR_MAX diff --git a/tools/testing/radix-tree/linux/slab.h b/tools/testing/radix-tree/linux/slab.h index 42a8f4dd2a63..ba42b8cc11d0 100644 --- a/tools/testing/radix-tree/linux/slab.h +++ b/tools/testing/radix-tree/linux/slab.h @@ -23,6 +23,7 @@ void kmem_cache_free(struct kmem_cache *cachep, void *objp); struct kmem_cache *kmem_cache_create(const char *name, unsigned int size, unsigned int align, unsigned int flags, void (*ctor)(void *)); -void kmem_cache_free_bulk(struct kmem_cache *, size_t, void **); -int kmem_cache_alloc_bulk(struct kmem_cache *, gfp_t, size_t, void **); + +void kmem_cache_free_bulk(struct kmem_cache *cachep, size_t, void **); +int kmem_cache_alloc_bulk(struct kmem_cache *cachep, gfp_t, size_t, void **); #endif /* SLAB_H */