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: <CAM_iQpXpbYAEFFf=Z=dh3ZR8KHysXD-MRScnC7pJUjx=8Z2siw@mail.gmail.com>
Date:   Fri, 26 May 2017 10:26:27 -0700
From:   Cong Wang <xiyou.wangcong@...il.com>
To:     Eric Dumazet <edumazet@...gle.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:13 AM, Eric Dumazet <edumazet@...gle.com> wrote:
> 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 ?

Oh, you're right, we always have the check on != &dst_default_metrics.


>
> I found that ATOMIC_INIT(1) was less ugly than the 0xdeadbeef

Of course.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ