Subject: Re: [PATCH net 1/2] rhashtable: unconditionally grow when max_shift is not specified

From: Daniel Borkmann <[email-masked]>
Date: Wed, 25 Feb 2015 17:36:38 +0100

On 02/25/2015 05:28 PM, Thomas Graf wrote:
> On 02/25/15 at 04:31pm, Daniel Borkmann wrote:
>> diff --git a/lib/test_rhashtable.c b/lib/test_rhashtable.c
>> index 58b9953..f9e9d73 100644
>> --- a/lib/test_rhashtable.c
>> +++ b/lib/test_rhashtable.c
>> @@ -202,8 +202,6 @@ static int __init test_rht_init(void)
>>   		.key_len = sizeof(int),
>>   		.hashfn = jhash,
>>   		.nulls_base = (3U << RHT_BASE_SHIFT),
>> -		.grow_decision = rht_grow_above_75,
>> -		.shrink_decision = rht_shrink_below_30,
>>   	};
>>   	int err;
>
> I assume you wanted this chunk in patch 2.

No, it's in this chunk on purpose. ;)

I've tried to explain it here in the commit message:

   Given that the test case verifies shrinks/expands manually, we also
   must remove pointer to the helper functions to explicitly avoid
   parallel resizing on insertions/deletions. test_bucket_stats() and
   test_rht_lookup() could also be wrapped around rhashtable mutex to
   explicitly synchronize a walk from resizing, but I think that defeats
   the actual test case which intended to have explicit test steps,
   i.e. 1) inserts, 2) expands, 3) shrinks, 4) deletions, with object
   verification after each stage.

If we leave it as is, the test case may fail due to a resize run
competing in parallel with the walk (as it's not using Herbert's
API) - I assume the purpose of the test case was to test expands
and shrinks manually in stages and walk/verify the table after
each step.

Cheers,
Daniel