summaryrefslogtreecommitdiff
path: root/patches/lib-rhashtable.patch
blob: 2e91f8d92d7ccfe33c59811066c692d38529d0f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

--- a/compat/lib-rhashtable.c
+++ b/compat/lib-rhashtable.c
@@ -175,10 +175,11 @@ static struct bucket_table *bucket_table
 	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;