Re: [PATCH 8/9] psi: pressure stall information for CPU, memory, and IO
From: Peter Zijlstra
Date: Mon Aug 06 2018 - 12:03:43 EST
On Mon, Aug 06, 2018 at 11:19:28AM -0400, Johannes Weiner wrote:
> On Fri, Aug 03, 2018 at 06:56:41PM +0200, Peter Zijlstra wrote:
> > On Wed, Aug 01, 2018 at 11:19:57AM -0400, Johannes Weiner wrote:
> > > + u32 uninitialized_var(nonidle);
> >
> > urgh.. I can see why the compiler got confused. Dodgy :-)
>
> :-) I think we can make this cleaner. Something like this (modulo the
> READ_ONCE/WRITE_ONCE you pointed out in the other email)?
>
> @@ -244,60 +287,17 @@ static bool psi_update_stats(struct psi_group *group)
> */
> for_each_online_cpu(cpu) {
> struct psi_group_cpu *groupc = per_cpu_ptr(group->pcpu, cpu);
> + u32 nonidle;
> +
> + nonidle = read_update_delta(groupc, PSI_NONIDLE, cpu);
> + nonidle = nsecs_to_jiffies(nonidle);
> + nonidle_total += nonidle;
> +
> + for (s = 0; s < PSI_NONIDLE; s++) {
> + u32 delta;
> +
> + delta = read_update_delta(groupc, s, cpu);
> + deltas[s] += (u64)delta * nonidle;
> }
> }
Yes, much clearer, thanks!