Message ID | 1449158919.6379.27.camel@edumazet-glaptop2.roam.corp.google.com |
---|---|
State | RFC, archived |
Delegated to: | David Miller |
Headers | show |
On Thu, Dec 03, 2015 at 08:08:39AM -0800, Eric Dumazet wrote: > > Well, it will fail before this point if memory is fragmented. Indeed, I was surprised that it even worked up to that point, possibly because the previous resizes might have actually been done in process context. > Anyway, __vmalloc() can be used with GFP_ATOMIC, have you tried this ? Ah I didn't know that. That would be much simpler. I'll give it a try. Thanks Eric!
diff --git a/lib/rhashtable.c b/lib/rhashtable.c index a54ff8949f91..9ef5d74963b2 100644 --- a/lib/rhashtable.c +++ b/lib/rhashtable.c @@ -120,8 +120,9 @@ static struct bucket_table *bucket_table_alloc(struct rhashtable *ht, if (size <= (PAGE_SIZE << PAGE_ALLOC_COSTLY_ORDER) || gfp != GFP_KERNEL) tbl = kzalloc(size, gfp | __GFP_NOWARN | __GFP_NORETRY); - if (tbl == NULL && gfp == GFP_KERNEL) - tbl = vzalloc(size); + if (tbl == NULL) + tbl = __vmalloc(size, gfp | __GFP_HIGHMEM | __GFP_ZERO, + PAGE_KERNEL); if (tbl == NULL) return NULL;