Re: [PATCH] sched/psi: clamp negative cpu_clock() skew

From: Peter Zijlstra

Date: Wed Sep 30 2026 - 12:44:21 EST


On Wed, Sep 30, 2026 at 10:22:52AM -0400, Johannes Weiner wrote:
> On Tue, Sep 29, 2026 at 10:17:40AM +0200, Peter Zijlstra wrote:
> > On Tue, Sep 29, 2026 at 10:10:04AM +0200, Peter Zijlstra wrote:
> >
> > > > When running browser workloads on an Intel N100 with a sustained
> > > > psi.mem.some of 2-3%, this underflow is observed once every couple of
> > > > hours.
> >
> > Reading is hard. This is sad, that's a relatively modern chip :-(
>
> I'm still struggling, but I'm under the weather so bear with me.
>
> That's a cpu_clock() implementation issue, right? "The value for
> cpu_clock(i) is monotonic for constant i". Presumably violating that
> would be a problem beyond psi?

Yeah, although most everybody has a filter on top for some reason or
another.

Mostly it could happen that when the watchdog would detect the TSC
wasn't stable after all, you'd be up a creek if you didn't also have
this filter.

But I'm very sad to see modern chips have shit TSC, that wasn't supposed
to happen.