Re: [PATCH v2] sched/topology: Avoid unsequenced accesses to jiffies in sd_init()

From: Nathan Chancellor

Date: Wed Nov 18 2026 - 02:57:15 EST


On Tue, Nov 17, 2026 at 10:39:15AM -0800, Nick Desaulniers wrote:
> On Tue, Nov 17, 2026 at 10:30 AM Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
> >
> > I don't speak enough C legal to actually understand the Changelog, but
> > the actual change seems daft. Is this really needed?

Yes, I would say this is needed. I am far from a C lawyer myself but I
think this is like any other undefined behavior: it might not be a real
problem now but it could always become one later.

> I would imagine a delta of the disassembly here before/after the
> change would make it more obvious (one less volatile access, which be
> have arbitrary ordering between initializing other members).
>
> But I guess I'm also curious why jiffies is defined as volatile
> anyway? I thought the usual guidance was to use
> cast-to-volatile-qualified pointer during access, rather than declare
> as volatile?

Maybe because jiffies is accessed a lot across the tree?

--
Cheers,
Nathan