lkml.org 
[lkml]   [2013]   [Sep]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/4] [RFC] net: Explicitly initialize u64_stats_sync structures for lockdep
On 09/26/2013 12:26 PM, Eric Dumazet wrote:
> On Thu, 2013-09-26 at 11:34 -0700, John Stultz wrote:
>> In order to enable lockdep on seqcount/seqlock structures, we
>> must explicitly initialize any locks.
>>
>> diff --git a/include/linux/u64_stats_sync.h b/include/linux/u64_stats_sync.h
>> index 8da8c4e..c450e11 100644
>> --- a/include/linux/u64_stats_sync.h
>> +++ b/include/linux/u64_stats_sync.h
>> @@ -67,6 +67,13 @@ struct u64_stats_sync {
>> #endif
>> };
>>
>> +
>> +#if BITS_PER_LONG == 32 && defined(CONFIG_SMP)
>> +#define u64_stats_init(syncp) seqcount_init(syncp.seq)
>> +#else
>> +#define u64_stats_init(syncp)
>> +#endif
>> +
> I would prefer a function.
>
> static inline void u64_stats_init(struct u64_stats_sync *syncp)
> {
> #if BITS_PER_LONG == 32 && defined(CONFIG_SMP)
> seqcount_init(&syncp->seq);
> #endif
> }

No objection, though I worry that will obscure the lockdep key name,
causing all the u64_stat_sync locks to appear the same.

I'll give it a quick shot to see if the compiler inlines it well enough
to preserve the name.

thanks
-john



\
 
 \ /
  Last update: 2013-09-26 22:01    [W:0.456 / U:0.324 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site