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

From: Nathan Chancellor

Date: Mon Nov 16 2026 - 13:55:10 EST


On Mon, Nov 16, 2026 at 10:36:45AM -0800, Nick Desaulniers wrote:
> On Sat, Nov 14, 2026 at 09:19:52PM -0700, Nathan Chancellor wrote:
> > + sd->last_balance = jiffies;
> > + sd->last_decay_max_lb_cost = jiffies;
>
> This pattern is going to wind up with two volatile (expensive) accesses,
> (with potentially different values) rather than one access and the same
> value by accessing `jiffies` once then storing the result in a temporary
> local (before the designated initializer), then using that to initialize
> the two fields in the designated initializer.

Thanks, I should have revisited this solution once I had a wider view of
the scope of this warning (it was one of the first patches I wrote)
because I definitely would have done that. I'll respin.

--
Cheers,
Nathan