maple_tree-add-test-to-replicate-low-memory-race-conditions.patch removed from -mm tree
The quilt patch titled
Subject: maple_tree: add test to replicate low memory race conditions
has been removed from the -mm tree. Its filename was
maple_tree-add-test-to-replicate-low-memory-race-conditions.patch
This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
------------------------------------------------------
From: Sidhartha Kumar <[email protected]>
Subject: maple_tree: add test to replicate low memory race conditions
Date: Mon, 12 Aug 2024 15:05:43 -0400
Add new callback fields to the userspace implementation of struct kmem_cache. This allows for executing callback functions in order to further test low memory scenarios where node allocation is retried.
This callback can help test race conditions by calling a function when a low memory event is tested.
---
lib/maple_tree.c | 13 +++++ tools/testing/radix-tree/maple.c | 63 +++++++++++++++++++++++++++++ tools/testing/shared/linux.c | 26 +++++++++++ 3 files changed, 101 insertions(+), 1 deletion(-)
lib/maple_tree.c renamed from lib/maple_tree.c~maple_tree-add-test-to-replicate-low-memory-race-conditions +13 -0
@@ -7005,6 +7005,19 @@ void mt_set_non_kernel(unsigned int val)kmem_cache_set_non_kernel (maple_node_cache, val); } +extern void kmem_cache_set_callback (struct kmem_cache *cachep, +void (*callback)(void *)); +void mt_set_callback (void (*callback)(void *)) +{ +kmem_cache_set_callback (maple_node_cache, callback); +} + +extern void kmem_cache_set_private (struct kmem_cache *cachep,void *private); +void mt_set_private (void *private) +{ +kmem_cache_set_private (maple_node_cache, private); +} +extern unsigned long kmem_cache_get_alloc (struct kmem_cache *);unsigned long mt_get_alloc_size (void ) {
tools/testing/radix-tree/maple.c renamed from tools/testing/radix-tree/maple.c~maple_tree-add-test-to-replicate-low-memory-race-conditions +63 -0
75 lines not on this page · raw message
tools/testing/shared/linux.c renamed from tools/testing/shared/linux.c~maple_tree-add-test-to-replicate-low-memory-race-conditions +25 -1
@@ -26,8 +26,21 @@ struct kmem_cache {unsigned int non_kernel;unsigned long nr_allocated;unsigned long nr_tallocated; +bool exec_callback; +void (*callback)(void *); +void *private; }; +void kmem_cache_set_callback (struct kmem_cache *cachep,void (*callback)(void *)) +{ + cachep->callback = callback; +} + +void kmem_cache_set_private (struct kmem_cache *cachep,void *private) +{ + cachep->private = private; +} +void kmem_cache_set_non_kernel (struct kmem_cache *cachep,unsigned int val) { cachep->non_kernel = val;
@@ -58,9 +71,17 @@ void *kmem_cache_alloc_lru(struct kmem_c {void *p; +if (cachep->exec_callback) { +if (cachep->callback) + cachep->callback (cachep->private); + cachep->exec_callback = false; + } +if (!(gfp & __GFP_DIRECT_RECLAIM)) { -if (!cachep->non_kernel) +if (!cachep->non_kernel) { + cachep->exec_callback = true;return NULL ; + } cachep->non_kernel--; }
@@ -223,6 +244,9 @@ kmem_cache_create(const char *name, unsi ret->objs =NULL ; ret->ctor = ctor; ret->non_kernel =0 ; + ret->exec_callback = false; + ret->callback =NULL ; + ret->private =NULL ;return ret; }
_
Patches currently in -mm which might be from [email protected] are