Skip to contentSkip to conversation

rhashtable-simplify-a-strange-allocation-pattern.patch removed from -mm tree

merged [email protected] 1 participant 1 message May 9, 2017

lore
Share & tools
lore

[email protected]

author tree notice Applied
#0 lore raw

The patch titled
Subject: lib/rhashtable.c: simplify a strange allocation pattern
has been removed from the -mm tree. Its filename was
rhashtable-simplify-a-strange-allocation-pattern.patch

This patch was dropped because it was merged into mainline or a subsystem tree

------------------------------------------------------
From: Michal Hocko <[email protected]>
Subject: lib/rhashtable.c: simplify a strange allocation pattern

alloc_bucket_locks allocation pattern is quite unusual. We are preferring vmalloc when CONFIG_NUMA is enabled. The rationale is that vmalloc will respect the memory policy of the current process and so the backing memory will get distributed over multiple nodes if the requester is configured properly. At least that is the intention, in reality rhastable is shrunk and expanded from a kernel worker so no mempolicy can be assumed.

Let's just simplify the code and use kvmalloc helper, which is a transparent way to use kmalloc with vmalloc fallback, if the caller is allowed to block and use the flag otherwise.

---

 lib/rhashtable.c |   13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)
lib/rhashtable.c renamed from lib/rhashtable.c~rhashtable-simplify-a-strange-allocation-pattern +0 -8
diff -puN lib/rhashtable.c~rhashtable-simplify-a-strange-allocation-pattern lib/rhashtable.c
@@ -86,16 +86,9 @@ static int alloc_bucket_locks(struct rha
 		size = min(size, 1U << tbl->nest);
 
 	if (sizeof(spinlock_t) != 0) {
-		tbl->locks = NULL;
-#ifdef CONFIG_NUMA
-		if (size * sizeof(spinlock_t) > PAGE_SIZE &&
-		    gfp == GFP_KERNEL)
-			tbl->locks = vmalloc(size * sizeof(spinlock_t));
-#endif
-		if (gfp != GFP_KERNEL)
-			gfp |= __GFP_NOWARN | __GFP_NORETRY;