On Fri, May 26, 2017 at 10:08 AM, Cong Wang <[email protected]> wrote:
> On Thu, May 25, 2017 at 2:27 PM, Eric Dumazet <[email protected]> wrote:
> Just one nit below.
>
>> -const u32 dst_default_metrics[RTAX_MAX + 1] = {
>> +const struct dst_metrics dst_default_metrics = {
>> /* This initializer is needed to force linker to place this variable
>> * into const section. Otherwise it might end into bss section.
>> * We really want to avoid false sharing on this variable, and catch
>> * any writes on it.
>> */
>> - [RTAX_MAX] = 0xdeadbeef,
>> + .refcnt = ATOMIC_INIT(1),
>> };
>
> The code comment above is no longer needed since
> we have to initialize refcnt to 1, instead of merely for const
> section.
I believe the comment is still needed, because normally we make sure
dst_default_metrics.refcnt is never touched (incremened nor
decremented)
So its value should not really matter ?
I found that ATOMIC_INIT(1) was less ugly than the 0xdeadbeef