Re: [PATCH 8/9] psi: pressure stall information for CPU, memory, and IO
From: Peter Zijlstra
Date: Fri Sep 07 2018 - 06:25:14 EST
On Tue, Aug 28, 2018 at 01:22:57PM -0400, Johannes Weiner wrote:
> +static void psi_clock(struct work_struct *work)
> +{
> + struct delayed_work *dwork;
> + struct psi_group *group;
> + bool nonidle;
> +
> + dwork = to_delayed_work(work);
> + group = container_of(dwork, struct psi_group, clock_work);
> +
> + /*
> + * If there is task activity, periodically fold the per-cpu
> + * times and feed samples into the running averages. If things
> + * are idle and there is no data to process, stop the clock.
> + * Once restarted, we'll catch up the running averages in one
> + * go - see calc_avgs() and missed_periods.
> + */
> +
> + nonidle = update_stats(group);
> +
> + if (nonidle) {
> + unsigned long delay = 0;
> + u64 now;
> +
> + now = sched_clock();
> + if (group->next_update > now)
> + delay = nsecs_to_jiffies(group->next_update - now) + 1;
> + schedule_delayed_work(dwork, delay);
> + }
> +}
Just a little nit; I would expect a function called *clock() to return a
time.