Skip to contentSkip to conversation

radix-tree-test-suite-add-kmem_cache_set_non_kernel.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message Sep 27, 2022

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: radix tree test suite: add kmem_cache_set_non_kernel()
has been removed from the -mm tree. Its filename was
radix-tree-test-suite-add-kmem_cache_set_non_kernel.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: "Liam R. Howlett" <[email protected]>
Subject: radix tree test suite: add kmem_cache_set_non_kernel()
Date: Tue, 6 Sep 2022 19:48:40 +0000

kmem_cache_set_non_kernel() is a mechanism to allow a certain number of kmem_cache_alloc requests to succeed even when GFP_KERNEL is not set in the flags. This functionality allows for testing different paths though the code.

---

 tools/testing/radix-tree/linux.c |   16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)
tools/testing/radix-tree/linux.c renamed from tools/testing/radix-tree/linux.c~radix-tree-test-suite-add-kmem_cache_set_non_kernel +14 -2
@@ -23,15 +23,26 @@ struct kmem_cache {
 	int nr_objs;
 	void *objs;
 	void (*ctor)(void *);
+	unsigned int non_kernel;
 };
 
+void kmem_cache_set_non_kernel(struct kmem_cache *cachep, unsigned int val)
+{
+	cachep->non_kernel = val;
+}
+
 void *kmem_cache_alloc_lru(struct kmem_cache *cachep, struct list_lru *lru,
 		int gfp)
+
 {
 	void *p;
 
-	if (!(gfp & __GFP_DIRECT_RECLAIM))
-		return NULL;
+	if (!(gfp & __GFP_DIRECT_RECLAIM)) {
+		if (!cachep->non_kernel)
+			return NULL;
+
+		cachep->non_kernel--;
+	}
 
 	pthread_mutex_lock(&cachep->lock);
 	if (cachep->nr_objs) {
@@ -90,5 +101,6 @@ kmem_cache_create(const char *name, unsi
 	ret->nr_objs = 0;
 	ret->objs = NULL;
 	ret->ctor = ctor;
+	ret->non_kernel = 0;
 	return ret;
 }

_

Patches currently in -mm which might be from [email protected] are