Re: [PATCH 2/5] lib/rhashtable: guarantee initial hashtable allocation

From: Michal Hocko
Date: Mon Jun 04 2018 - 07:46:37 EST


On Fri 01-06-18 09:01:22, Davidlohr Bueso wrote:
[...]
> diff --git a/lib/rhashtable.c b/lib/rhashtable.c
> index 05a4b1b8b8ce..ae17da6f0c75 100644
> --- a/lib/rhashtable.c
> +++ b/lib/rhashtable.c
> @@ -175,7 +175,7 @@ static struct bucket_table *bucket_table_alloc(struct rhashtable *ht,
> int i;
>
> size = sizeof(*tbl) + nbuckets * sizeof(tbl->buckets[0]);
> - if (gfp != GFP_KERNEL)
> + if ((gfp & ~__GFP_NOFAIL) != GFP_KERNEL)
> tbl = kzalloc(size, gfp | __GFP_NOWARN | __GFP_NORETRY);
> else
> tbl = kvzalloc(size, gfp);

Just a heads up. This is not longer needed after
http://lkml.kernel.org/r/20180601115329.27807-1-mhocko@xxxxxxxxxx
is applied. Moreover it will conflict at that spot.

--
Michal Hocko
SUSE Labs