Re: [PATCH v2 1/2] sched: cgroup SCHED_IDLE support

From: Josh Don
Date: Tue Aug 03 2021 - 16:38:05 EST


Hi Jun,

> > @@ -7123,8 +7178,21 @@ static void check_preempt_wakeup(struct rq *rq, struct task_struct *p, int wake_
> > return;
> >
> > find_matching_se(&se, &pse);
> > - update_curr(cfs_rq_of(se));
> > BUG_ON(!pse);
> > +
> > + cse_is_idle = se_is_idle(se);
> > + pse_is_idle = se_is_idle(pse);
> > +
> > + /*
> > + * Preempt an idle group in favor of a non-idle group (and don't preempt
> > + * in the inverse case).
> > + */
> > + if (cse_is_idle && !pse_is_idle)
> > + goto preempt;
>
> In the next schedule, it will pick next entity, How do we ensure that
> the entity selected next time will not be an idle
> entity. So I think we need to do something to idle group when picking
> next entity, For example, when we pick next
> entity, we try to choose normal group as much as possible.

Yep, exactly, this is achieved by adjusting the weight of idle
entities to the minimum value (see sched_group_set_idle()).

> Do we need to do something in the sched tick for the situation with
> idle entities?

check_preempt_tick() should already be sufficient, given that vruntime
for idle entities will advance quickly, and in patch 2/2 I adjusted
the sched_slice for idle entities to allow for smaller than
min_granularity. Did you have a more specific concern?

Best,
Josh