Re: [PATCH] [RFC] sched: restrict iowait boost for boosted task only

From: Wei Wang
Date: Fri Jan 24 2020 - 15:56:11 EST


On Fri, Jan 24, 2020 at 3:30 AM Qais Yousef <qais.yousef@xxxxxxx> wrote:
>
> On 01/24/20 11:01, Valentin Schneider wrote:
> > On 24/01/2020 09:51, Quentin Perret wrote:
> > >>> +static inline bool iowait_boosted(struct task_struct *p)
> > >>> +{
> > >>> + return p->in_iowait && uclamp_eff_value(p, UCLAMP_MIN) > 0;
> > >>
> > >> I think this is overloading the usage of util clamp. You're basically using
> > >> cpu.uclamp.min to temporarily switch iowait boost on/off.
> > >>
> > >> Isn't it better to add a new cgroup attribute to toggle this feature?
> > >>
> > >> The problem does seem generic enough and could benefit other battery-powered
> > >> devices outside of the Android world. I don't think the dependency on uclamp &&
> > >> energy model are necessary to solve this.
> > >
> > > I think using uclamp is not a bad idea here, but perhaps we could do
> > > things differently. As of today the iowait boost escapes the clamping
> > > mechanism, so one option would be to change that. That would let us set
> > > a low max clamp in the 'background' cgroup, which in turns would limit
> > > the frequency request for those tasks even if they're IO-intensive.
> > >
> >
> > So I'm pretty sure we *do* want tasks with the default clamps to get iowait
> > boost'd. What we don't want are background tasks driving up the frequency,
> > and that should be via uclamp.max (as Quentin is suggesting) rather than
> > uclamp.min (as is suggested in the patch).
> >
> > Now, whether that is overloading the usage of uclamp... I'm not sure.
> > One of the argument for uclamp was actually frequency selection, so if
> > we just make iowait boost respect that, IOW not boost further than
> > uclamp.max (which is a bit better than a simple on/off switch), that
> > wouldn't be too crazy I think.
>
> Capping iowait boost value in schedutil based on uclamp makes sense indeed.
>
> What didn't make sense to me is the use of uclamp as a switch to toggle iowait
> boost on/off.
>
> Cheers
>
> --
> Qais Yousef


Sounds like we all agree on adding a new toggle, so will move forward
with that then.
For capping iowait boost, it should be a seperate patch. I am not sure
if we want to apply what's the current max clamp on the rq but I do
see the per-task iowait boost makes sense.