lkml.org 
[lkml]   [2018]   [May]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/6] lib/rhashtable: guarantee initial hashtable allocation
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.

Thanks,
Davidlohr

\
 
 \ /
  Last update: 2018-05-29 19:21    [W:0.066 / U:2.976 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site