Re: [PATCH 07/10 v7] sunrpc: Switch to using list_head instead single list

Kinglong Mee
2015-07-13T08:27:33Z

On 7/13/2015 09:30, NeilBrown wrote:
> On Sat, 11 Jul 2015 20:50:26 +0800 Kinglong Mee <kinglongmee@gmail.com>
> wrote:
>
>> Switch using list_head for cache_head in cache_detail,
>> it is useful of remove an cache_head entry directly from cache_detail.
>>
>> v7, same as v6.
>>
>> Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
>> ---
>> include/linux/sunrpc/cache.h | 4 +--
>> net/sunrpc/cache.c | 74 ++++++++++++++++++++++++--------------------
>> 2 files changed, 43 insertions(+), 35 deletions(-)
>>
>> diff --git a/include/linux/sunrpc/cache.h b/include/linux/sunrpc/cache.h
>> index 04ee5a2..ecc0ff6 100644
>> --- a/include/linux/sunrpc/cache.h
>> +++ b/include/linux/sunrpc/cache.h
>> @@ -46,7 +46,7 @@
>> *
>> */
>> struct cache_head {
>> - struct cache_head * next;
>> + struct list_head cache_list;
>> time_t expiry_time; /* After time time, don't use the data */
>> time_t last_refresh; /* If CACHE_PENDING, this is when upcall
>> * was sent, else this is when update was received
>> @@ -73,7 +73,7 @@ struct cache_detail_pipefs {
>> struct cache_detail {
>> struct module * owner;
>> int hash_size;
>> - struct cache_head ** hash_table;
>> + struct list_head * hash_table;
>> rwlock_t hash_lock;
>
> Given that these lists are chains in a hash table, it would make more
> sense to use hlist_head rather than list_head. They are designed for
> exactly that purpose - and are smaller.
>
> Actually, I'd really like to see hlist_bl_head used - so there was one
> bit-spin-lock per chain, and use RCU for protecting searches.
> However that would have to be left for later - no point delaying this
> patch set for some minor performance gains.
>
> But as you need to change this, I think it would be best to change to
> hlist_head.

Got it.
I will update and test it.

thanks,
Kinglong Mee

>
> By the way, I see lots of nice clean-ups in this series. Thanks!
>
> NeilBrown