lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANn89i+_TqFHa9dNFFSbe6msYaWyWr7RfN7_LURs+XL9gd94Pw@mail.gmail.com>
Date:   Fri, 26 May 2017 10:13:00 -0700
From:   Eric Dumazet <edumazet@...gle.com>
To:     Cong Wang <xiyou.wangcong@...il.com>
Cc:     Eric Dumazet <eric.dumazet@...il.com>,
        David Miller <davem@...emloft.net>,
        Andrey Konovalov <andreyknvl@...gle.com>,
        Julian Anastasov <ja@....bg>, netdev <netdev@...r.kernel.org>
Subject: Re: [PATCH net] ipv4: add reference counting to metrics

On Fri, May 26, 2017 at 10:08 AM, Cong Wang <xiyou.wangcong@...il.com> wrote:
> On Thu, May 25, 2017 at 2:27 PM, Eric Dumazet <eric.dumazet@...il.com> 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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ