Re: [PATCH] psi: fix randomized calculation in record_times()

From: Yafang Shao
Date: Fri Apr 03 2020 - 22:32:23 EST


On Fri, Apr 3, 2020 at 11:20 PM Johannes Weiner <hannes@xxxxxxxxxxx> wrote:
>
> On Fri, Apr 03, 2020 at 04:55:25AM -0400, Yafang Shao wrote:
> > @@ -690,7 +690,10 @@ static void psi_group_change(struct psi_group *group, int cpu,
> > */
> > write_seqcount_begin(&groupc->seq);
> >
> > - record_times(groupc, cpu, false);
> > + if (groupc->total_tasks)
> > + record_times(groupc, cpu, false);
> > + else
> > + groupc->state_start = cpu_clock(cpu);
>
> This change appears is a no-op. If there are no tasks,
> groupc->state_mask is 0, and the only thing record_times() does is
>
> groupc->state_start = cpu_clock(cpu);
>
> Did you encounter actual problems, or are you just reading the code?

No real issues. Just reading the code and found it looks like a little weird.
But as you explained that state_mask can also guarantee it then we
don't need to make this change.

Thanks for the explanation.

Thanks
Yafang