提交 d3716f18 编写于 作者: H Herbert Xu 提交者: David S. Miller

rhashtable: Use __vmalloc with GFP_ATOMIC for table allocation

When an rhashtable user pounds rhashtable hard with back-to-back
insertions we may end up growing the table in GFP_ATOMIC context.
Unfortunately when the table reaches a certain size this often
fails because we don't have enough physically contiguous pages
to hold the new table.

Eric Dumazet suggested (and in fact wrote this patch) using
__vmalloc instead which can be used in GFP_ATOMIC context.
Reported-by: NPhil Sutter <phil@nwl.cc>
Suggested-by: NEric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 6a61d4db
...@@ -120,8 +120,9 @@ static struct bucket_table *bucket_table_alloc(struct rhashtable *ht, ...@@ -120,8 +120,9 @@ static struct bucket_table *bucket_table_alloc(struct rhashtable *ht,
if (size <= (PAGE_SIZE << PAGE_ALLOC_COSTLY_ORDER) || if (size <= (PAGE_SIZE << PAGE_ALLOC_COSTLY_ORDER) ||
gfp != GFP_KERNEL) gfp != GFP_KERNEL)
tbl = kzalloc(size, gfp | __GFP_NOWARN | __GFP_NORETRY); tbl = kzalloc(size, gfp | __GFP_NOWARN | __GFP_NORETRY);
if (tbl == NULL && gfp == GFP_KERNEL) if (tbl == NULL)
tbl = vzalloc(size); tbl = __vmalloc(size, gfp | __GFP_HIGHMEM | __GFP_ZERO,
PAGE_KERNEL);
if (tbl == NULL) if (tbl == NULL)
return NULL; return NULL;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册