From: Eric Dumazet <eric.dumazet@gmail.com>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Phil Sutter <phil@nwl.cc>,
davem@davemloft.net, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, tgraf@suug.ch,
fengguang.wu@intel.com, wfg@linux.intel.com, lkp@01.org
Subject: Re: rhashtable: ENOMEM errors when hit with a flood of insertions
Date: Thu, 03 Dec 2015 08:08:39 -0800 [thread overview]
Message-ID: <1449158919.6379.27.camel@edumazet-glaptop2.roam.corp.google.com> (raw)
In-Reply-To: <20151203125117.GB5505@gondor.apana.org.au>
On Thu, 2015-12-03 at 20:51 +0800, Herbert Xu wrote:
> On Mon, Nov 30, 2015 at 06:18:59PM +0800, Herbert Xu wrote:
> >
> > OK that's better. I think I see the problem. The test in
> > rhashtable_insert_rehash is racy and if two threads both try
> > to grow the table one of them may be tricked into doing a rehash
> > instead.
> >
> > I'm working on a fix.
>
> While the EBUSY errors are gone for me, I can still see plenty
> of ENOMEM errors. In fact it turns out that the reason is quite
> understandable. When you pound the rhashtable hard so that it
> doesn't actually get a chance to grow the table in process context,
> then the table will only grow with GFP_ATOMIC allocations.
>
> For me this starts failing regularly at around 2^19 entries, which
> requires about 1024 contiguous pages if I'm not mistaken.
Well, it will fail before this point if memory is fragmented.
Anyway, __vmalloc() can be used with GFP_ATOMIC, have you tried this ?
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;
next prev parent reply other threads:[~2015-12-03 16:08 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-20 17:17 [PATCH v2 0/4] improve fault-tolerance of rhashtable runtime-test Phil Sutter
2015-11-20 17:17 ` [PATCH v2 1/4] rhashtable-test: add cond_resched() to thread test Phil Sutter
2015-11-20 17:17 ` [PATCH v2 2/4] rhashtable-test: retry insert operations Phil Sutter
2015-11-20 17:17 ` [PATCH v2 3/4] rhashtable-test: calculate max_entries value by default Phil Sutter
2015-11-20 17:17 ` [PATCH v2 4/4] rhashtable-test: allow to retry even if -ENOMEM was returned Phil Sutter
2015-11-20 17:28 ` Phil Sutter
2015-11-23 17:38 ` [PATCH v2 0/4] improve fault-tolerance of rhashtable runtime-test David Miller
2015-11-30 9:37 ` Herbert Xu
2015-11-30 10:14 ` Phil Sutter
2015-11-30 10:18 ` Herbert Xu
2015-12-03 12:41 ` rhashtable: Prevent spurious EBUSY errors on insertion Herbert Xu
2015-12-03 15:38 ` Phil Sutter
2015-12-04 19:38 ` David Miller
2015-12-17 8:46 ` Xin Long
2015-12-17 8:48 ` Herbert Xu
2015-12-17 9:00 ` Xin Long
2015-12-17 16:07 ` Xin Long
2015-12-18 2:26 ` Herbert Xu
2015-12-18 8:18 ` Xin Long
2015-12-17 17:00 ` David Miller
2015-12-03 12:51 ` rhashtable: ENOMEM errors when hit with a flood of insertions Herbert Xu
2015-12-03 15:08 ` David Laight
2015-12-03 16:08 ` Eric Dumazet [this message]
2015-12-04 0:07 ` Herbert Xu
2015-12-04 14:39 ` rhashtable: Use __vmalloc with GFP_ATOMIC for table allocation Herbert Xu
2015-12-04 17:01 ` Phil Sutter
2015-12-04 17:45 ` Eric Dumazet
2015-12-04 18:15 ` Phil Sutter
2015-12-05 7:06 ` Herbert Xu
2015-12-07 15:35 ` Thomas Graf
2015-12-07 19:29 ` David Miller
2015-12-09 2:18 ` Thomas Graf
2015-12-09 2:24 ` Herbert Xu
2015-12-09 2:36 ` Thomas Graf
2015-12-09 2:38 ` Herbert Xu
2015-12-09 2:42 ` Thomas Graf
2015-12-04 21:53 ` David Miller
2015-12-05 7:03 ` Herbert Xu
2015-12-06 3:48 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1449158919.6379.27.camel@edumazet-glaptop2.roam.corp.google.com \
--to=eric.dumazet@gmail.com \
--cc=davem@davemloft.net \
--cc=fengguang.wu@intel.com \
--cc=herbert@gondor.apana.org.au \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@01.org \
--cc=netdev@vger.kernel.org \
--cc=phil@nwl.cc \
--cc=tgraf@suug.ch \
--cc=wfg@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).