]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
tools: Add SLUB percpu array functions for testing
authorLiam R. Howlett <Liam.Howlett@oracle.com>
Tue, 8 Aug 2023 18:58:13 +0000 (14:58 -0400)
committerVlastimil Babka <vbabka@suse.cz>
Thu, 25 Jan 2024 09:56:40 +0000 (10:56 +0100)
Support new percpu array functions to the test code so they can be used
in the maple tree testing.

Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
tools/include/linux/slab.h
tools/testing/radix-tree/linux.c
tools/testing/radix-tree/linux/kernel.h

index 311759ea25e9214b31cd8afc3b64cea1213972de..1043f9c5ef4ef40452ad37e818083e932f4e66b9 100644 (file)
@@ -7,6 +7,7 @@
 
 #define SLAB_PANIC 2
 #define SLAB_RECLAIM_ACCOUNT    0x00020000UL            /* Objects are reclaimable */
+#define SLAB_NO_MERGE          0x01000000UL            /* Prevent merging with compatible kmem caches */
 
 #define kzalloc_node(size, flags, node) kmalloc(size, flags)
 
@@ -45,4 +46,7 @@ void kmem_cache_free_bulk(struct kmem_cache *cachep, size_t size, void **list);
 int kmem_cache_alloc_bulk(struct kmem_cache *cachep, gfp_t gfp, size_t size,
                          void **list);
 
+int kmem_cache_setup_percpu_array(struct kmem_cache *s, unsigned int count);
+int kmem_cache_prefill_percpu_array(struct kmem_cache *s, unsigned int count,
+               gfp_t gfp);
 #endif         /* _TOOLS_SLAB_H */
index 4eb442206d019acf29576c3caa4503941f59a229..597590a2dd84471f4329e3bd28ae3face72ac4db 100644 (file)
@@ -208,6 +208,20 @@ int kmem_cache_alloc_bulk(struct kmem_cache *cachep, gfp_t gfp, size_t size,
        return size;
 }
 
+int kmem_cache_setup_percpu_array(struct kmem_cache *s, unsigned int count)
+{
+       return 0;
+}
+
+int kmem_cache_prefill_percpu_array(struct kmem_cache *s, unsigned int count,
+               gfp_t gfp)
+{
+       if (count > s->non_kernel)
+               return s->non_kernel;
+
+       return count;
+}
+
 struct kmem_cache *
 kmem_cache_create(const char *name, unsigned int size, unsigned int align,
                unsigned int flags, void (*ctor)(void *))
index c5c9d05f29da95e4b7d0b462675fde9dcc028924..fc75018974de1022afbc0a1d67b10ad06e7658e0 100644 (file)
@@ -15,6 +15,7 @@
 
 #define printk printf
 #define pr_err printk
+#define pr_warn printk
 #define pr_info printk
 #define pr_debug printk
 #define pr_cont printk