[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180529180428.l6yt6ae4oxbgrja6@gondor.apana.org.au>
Date: Wed, 30 May 2018 02:04:28 +0800
From: Herbert Xu <herbert@...dor.apana.org.au>
To: Davidlohr Bueso <dave@...olabs.net>
Cc: akpm@...ux-foundation.org, torvalds@...ux-foundation.org,
tgraf@...g.ch, manfred@...orfullife.com,
guillaume.knispel@...ersonicimagine.com, linux-api@...r.kernel.org,
linux-kernel@...r.kernel.org, Davidlohr Bueso <dbueso@...e.de>
Subject: Re: [PATCH 2/6] lib/rhashtable: guarantee initial hashtable
allocation
On Tue, May 29, 2018 at 10:03:38AM -0700, Davidlohr Bueso wrote:
> On Mon, 28 May 2018, Herbert Xu wrote:
> > > + /*
> > > + * This is api initialization and thus we need to guarantee the
> > > + * initial rhashtable allocation. Upon failure, retry with a
> > > + * smallest possible size, otherwise we exhaust our options with
> > > + * __GFP_NOFAIL.
> > > + */
> > > tbl = bucket_table_alloc(ht, size, GFP_KERNEL);
> > > - if (tbl == NULL)
> > > - return -ENOMEM;
> > > + if (unlikely(tbl == NULL)) {
> > > + size = HASH_MIN_SIZE;
> > > +
> > > + tbl = bucket_table_alloc(ht, size, GFP_KERNEL);
> > > + if (tbl == NULL)
> > > + tbl = bucket_table_alloc_retry(ht, size, GFP_KERNEL);
> > > + }
> >
> > Perhaps you should also explain here why we don't just try the
> > minimum size with __GFP_NOFAIL as the second step rather than the
> > third.
>
> Please see the comment above, I try to explain the rationale.
It doesn't explain it at all. In fact I don't see why we neeed
three attempts, just do the GFP_NOFAIL as the second and final step.
Thanks,
--
Email: Herbert Xu <herbert@...dor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
Powered by blists - more mailing lists