Re: [PATCH 6/7] psi: pressure stall information for CPU, memory, and IO

From: Peter Zijlstra
Date: Wed May 09 2018 - 06:27:05 EST


On Mon, May 07, 2018 at 05:01:34PM -0400, Johannes Weiner wrote:
> +static void psi_clock(struct work_struct *work)
> +{

> + dwork = to_delayed_work(work);
> + group = container_of(dwork, struct psi_group, clock_work);
> +

> +
> + /* Keep the clock ticking only when there is action */
> + if (nonidle_total)
> + schedule_delayed_work(dwork, MY_LOAD_FREQ);
> +}

Note that this doesn't generate a stable frequency for the callback.
The (nondeterministic) time spend doing the actual work is added to each
period, this gives an unconditional downward bias to the frequency, but
also makes it very unstable.

You want explicit management of timer->expires, and add MY_LOAD_FREQ
(which is a misnomer) to it and not reset it based on jiffies.