summaryrefslogtreecommitdiff
path: root/patches
diff options
context:
space:
mode:
authorHauke Mehrtens <hauke@hauke-m.de>2017-08-22 00:28:08 +0200
committerJohannes Berg <johannes.berg@intel.com>2017-09-08 15:23:13 +0200
commitb402f77b918087f7113873a91236d5a6868a5aba (patch)
treec9c8b43c3605da13bd2552740d8b96e66d8a27f3 /patches
parent7c827d5ac9c18d9c069af3b4a7f820a69c23da3d (diff)
compat: avoid usage of kvzalloc() in rhashtable.c
This reverts commit 12e8fd6fd3802 ("lib/rhashtable.c: use kvzalloc() in bucket_table_alloc() when possible") from upstream kernel. Kernel versions older that 4.12 do not have kvzalloc() try to avoid the usage of this. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'patches')
-rw-r--r--patches/lib-rhashtable.patch17
1 files changed, 15 insertions, 2 deletions
diff --git a/patches/lib-rhashtable.patch b/patches/lib-rhashtable.patch
index 9c262b02..35424efb 100644
--- a/patches/lib-rhashtable.patch
+++ b/patches/lib-rhashtable.patch
@@ -27,6 +27,19 @@
if (!tbl->locks)
return -ENOMEM;
for (i = 0; i < size; i++)
---
-1.9.1
+@@ -226,10 +226,11 @@ static struct bucket_table *bucket_table_alloc(struct rhashtable *ht,
+ int i;
+
+ size = sizeof(*tbl) + nbuckets * sizeof(tbl->buckets[0]);
+- if (gfp != GFP_KERNEL)
++ if (size <= (PAGE_SIZE << PAGE_ALLOC_COSTLY_ORDER) ||
++ gfp != GFP_KERNEL)
+ tbl = kzalloc(size, gfp | __GFP_NOWARN | __GFP_NORETRY);
+- else
+- tbl = kvzalloc(size, gfp);
++ if (tbl == NULL && gfp == GFP_KERNEL)
++ tbl = vzalloc(size);
+
+ size = nbuckets;
+