Re: [PATCH v3 3/4] sched: reduce sched slice for SCHED_IDLE entities
From: Jiang Biao
Date: Tue Aug 24 2021 - 22:44:36 EST
On Wed, 25 Aug 2021 at 01:04, Josh Don <joshdon@xxxxxxxxxx> wrote:
>
> Hi Jiang,
>
> On Tue, Aug 24, 2021 at 3:25 AM Jiang Biao <benbjiang@xxxxxxxxx> wrote:
> >
> > Why not just ignore min granularity when normal entities compete with
> > a SCHED_IDLE entity? something like this,
> >
> > @@ -697,8 +710,14 @@ static u64 sched_slice(struct cfs_rq *cfs_rq,
> > struct sched_entity *se)
> > slice = __calc_delta(slice, se->load.weight, load);
> > }
> >
> > - if (sched_feat(BASE_SLICE))
> > - slice = max(slice, (u64)sysctl_sched_min_granularity);
> > + if (sched_feat(BASE_SLICE)
> > + && (!se_is_idle(init_se) || sched_idle_cfs_rq(cfs_rq)))
> > + slice = max(slice, (u64)sysctl_sched_min_granularity);
> >
> > return slice;
> > }
> > If so, there seems no need to introduce sysctl_sched_idle_min_granularity? :)
>
> Ignoring min_gran entirely could lead to some really tiny slices; see
> discussion at https://lkml.org/lkml/2021/8/12/651.
Got it, tiny slices could be a problem in SCHED_HRTICK case.
But the sysctl_sched_idle_min_granularity used in sched_slice() and
sysctl_sched_min_granularity used in check_preempt_tick would have
different semantics for SCHED_IDLE task, which could be functional ok
but a little confusing.
Regards,
Jiang