On Fri, May 26, 2017 at 10:13 AM, Eric Dumazet <eduma...@google.com> wrote: > On Fri, May 26, 2017 at 10:08 AM, Cong Wang <xiyou.wangc...@gmail.com> wrote: >> On Thu, May 25, 2017 at 2:27 PM, Eric Dumazet <eric.duma...@gmail.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.