Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1283881
| From | Herbert Xu <herbert@gondor.apana.org.au> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | rhashtable: Use __vmalloc with GFP_ATOMIC for table allocation |
| Date | 2015-12-04 15:50 +0100 |
| Message-ID | <qBZQm-3Yo-27@gated-at.bofh.it> (permalink) |
| References | (1 earlier) <qAt6b-1Ny-17@gated-at.bofh.it> <qAtIR-2gq-1@gated-at.bofh.it> <qAtIR-2gq-15@gated-at.bofh.it> <qBBEn-58q-15@gated-at.bofh.it> <qBECe-7oz-17@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Thu, Dec 03, 2015 at 08:08:39AM -0800, Eric Dumazet wrote: > > Anyway, __vmalloc() can be used with GFP_ATOMIC, have you tried this ? OK I've tried it and I no longer get any ENOMEM errors! ---8<--- 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: Phil Sutter <phil@nwl.cc> Suggested-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> diff --git a/lib/rhashtable.c b/lib/rhashtable.c index a54ff89..1c624db 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; -- Email: Herbert Xu <herbert@gondor.apana.org.au> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
rhashtable: ENOMEM errors when hit with a flood of insertions Herbert Xu <herbert@gondor.apana.org.au> - 2015-12-03 14:00 +0100
RE: rhashtable: ENOMEM errors when hit with a flood of insertions David Laight <David.Laight@ACULAB.COM> - 2015-12-03 16:20 +0100
Re: rhashtable: ENOMEM errors when hit with a flood of insertions Eric Dumazet <eric.dumazet@gmail.com> - 2015-12-03 17:10 +0100
Re: rhashtable: ENOMEM errors when hit with a flood of insertions Herbert Xu <herbert@gondor.apana.org.au> - 2015-12-04 01:10 +0100
rhashtable: Use __vmalloc with GFP_ATOMIC for table allocation Herbert Xu <herbert@gondor.apana.org.au> - 2015-12-04 15:50 +0100
Re: rhashtable: Use __vmalloc with GFP_ATOMIC for table allocation Eric Dumazet <eric.dumazet@gmail.com> - 2015-12-04 18:50 +0100
Re: rhashtable: Use __vmalloc with GFP_ATOMIC for table allocation Phil Sutter <phil@nwl.cc> - 2015-12-04 19:20 +0100
Re: rhashtable: Use __vmalloc with GFP_ATOMIC for table allocation Herbert Xu <herbert@gondor.apana.org.au> - 2015-12-05 08:10 +0100
Re: rhashtable: Use __vmalloc with GFP_ATOMIC for table allocation Thomas Graf <tgraf@suug.ch> - 2015-12-07 16:40 +0100
Re: rhashtable: Use __vmalloc with GFP_ATOMIC for table allocation David Miller <davem@davemloft.net> - 2015-12-07 20:40 +0100
Re: rhashtable: Use __vmalloc with GFP_ATOMIC for table allocation Thomas Graf <tgraf@suug.ch> - 2015-12-09 03:20 +0100
Re: rhashtable: Use __vmalloc with GFP_ATOMIC for table allocation Herbert Xu <herbert@gondor.apana.org.au> - 2015-12-09 03:30 +0100
Re: rhashtable: Use __vmalloc with GFP_ATOMIC for table allocation Herbert Xu <herbert@gondor.apana.org.au> - 2015-12-09 03:40 +0100
Re: rhashtable: Use __vmalloc with GFP_ATOMIC for table allocation Thomas Graf <tgraf@suug.ch> - 2015-12-09 03:50 +0100
Re: rhashtable: Use __vmalloc with GFP_ATOMIC for table allocation Thomas Graf <tgraf@suug.ch> - 2015-12-09 03:40 +0100
Re: rhashtable: Use __vmalloc with GFP_ATOMIC for table allocation David Miller <davem@davemloft.net> - 2015-12-04 23:00 +0100
Re: rhashtable: Use __vmalloc with GFP_ATOMIC for table allocation Herbert Xu <herbert@gondor.apana.org.au> - 2015-12-05 08:10 +0100
Re: rhashtable: Use __vmalloc with GFP_ATOMIC for table allocation David Miller <davem@davemloft.net> - 2015-12-06 04:50 +0100
csiph-web