Re: [PATCH 2/6] rhashtable: remove incorrect comment on r{hl, hash}table_walk_enter()
From: NeilBrown
Date: Wed Apr 18 2018 - 18:56:46 EST
On Wed, Apr 18 2018, Herbert Xu wrote:
> On Wed, Apr 18, 2018 at 04:47:01PM +1000, NeilBrown wrote:
>> Neither rhashtable_walk_enter() or rhltable_walk_enter() sleep, so
>> remove the comments which suggest that they do.
>>
>> Signed-off-by: NeilBrown <neilb@xxxxxxxx>
>> ---
>> include/linux/rhashtable.h | 3 ---
>> lib/rhashtable.c | 3 ---
>> 2 files changed, 6 deletions(-)
>>
>> diff --git a/include/linux/rhashtable.h b/include/linux/rhashtable.h
>> index 87d443a5b11d..b01d88e196c2 100644
>> --- a/include/linux/rhashtable.h
>> +++ b/include/linux/rhashtable.h
>> @@ -1268,9 +1268,6 @@ static inline int rhashtable_walk_init(struct rhashtable *ht,
>> * For a completely stable walk you should construct your own data
>> * structure outside the hash table.
>> *
>> - * This function may sleep so you must not call it from interrupt
>> - * context or with spin locks held.
>
> It does a naked spin lock so even though we removed the memory
> allocation you still mustn't call it from interrupt context.
>
> Why do you need to do that anyway?
I don't want to do that - I just want the documentation to be correct
(or at least, not be blatantly incorrect). The function does not sleep,
and is safe to call with spin locks held.
Do we need to spell out when it can be called? If so, maybe:
This function may be called from any process context, including
non-preemptable context, but cannot be called from interrupts.
??
Thanks,
NeilBrown
Attachment:
signature.asc
Description: PGP signature