Subject: Re: [PATCH net-next v2 6/7] rhashtable: initialize atomic nelems variable

From: Ying Xue <[email-masked]>
Date: Wed, 7 Jan 2015 18:26:21 +0800

On 01/07/2015 05:53 PM, Thomas Graf wrote:
> On 01/07/15 at 01:41pm, Ying Xue wrote:
>> Signed-off-by: Ying Xue <[email-masked]>
>> Cc: Thomas Graf <[email-masked]>
> 
> Is this really needed at all? We initialize the full rhashtable
> struct to 0 in rhashtable_init().
> 
> 

I am not sure whether we really need to reinitialize atomic variable
again although we have reset it with memset() or something else. But I
see many places in kernel where we do this, for example:

Although we use kmem_cache_zalloc() to allocate "net" structure instance
in net_alloc(), there are still several places where to reinitialize its
atomic variables again:

setup_net()
  atomic_set(&net->use_count, 0);

rt_genid_init()
  atomic_set(&net->ipv4.rt_genid, 0);
  atomic_set(&net->fnhe_genid, 0);

Can you please definitely confirm that the reinitialisation is redundant
for us?

Regards,
Ying