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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jun 21, 2018 at 02:28:23PM -0700, Davidlohr Bueso wrote:
> rhashtable_init() may fail due to -ENOMEM, thus making the
> entire api unusable. This patch removes this scenario,
> however unlikely. In order to guarantee memory allocation,
> this patch always ends up doing GFP_KERNEL|__GFP_NOFAIL
> for both the tbl as well as alloc_bucket_spinlocks().
> 
> Upon the first table allocation failure, we shrink the
> size to the smallest value that makes sense and retry with
> __GFP_NOFAIL semantics. With the defaults, this means that
> from 64 buckets, we retry with only 4. Any later issues
> regarding performance due to collisions or larger table
> resizing (when more memory becomes available) is the least
> of our problems.
> 
> Signed-off-by: Davidlohr Bueso <dbueso@xxxxxxx>

Acked-by: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>

Thanks,
-- 
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
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-api" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux