Re: [PATCH 5/8] sched,cfs: use explicit cfs_rq of parent se helper

From: Rik van Riel
Date: Wed Jun 26 2019 - 12:15:14 EST


On Wed, 2019-06-26 at 17:58 +0200, Dietmar Eggemann wrote:
> On 6/12/19 9:32 PM, Rik van Riel wrote:
> > Use an explicit "cfs_rq of parent sched_entity" helper in a few
> > strategic places, where cfs_rq_of(se) may no longer point at the
> > right runqueue once we flatten the hierarchical cgroup runqueues.
> >
> > No functional change.
> >
> > Signed-off-by: Rik van Riel <riel@xxxxxxxxxxx>
> > ---
> > kernel/sched/fair.c | 17 +++++++++++++----
> > 1 file changed, 13 insertions(+), 4 deletions(-)
> >
> > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> > index dcc521d251e3..c6ede2ecc935 100644
> > --- a/kernel/sched/fair.c
> > +++ b/kernel/sched/fair.c
> > @@ -275,6 +275,15 @@ static inline struct cfs_rq
> > *group_cfs_rq(struct sched_entity *grp)
> > return grp->my_q;
> > }
> >
> > +/* runqueue owned by the parent entity */
> > +static inline struct cfs_rq *group_cfs_rq_of_parent(struct
> > sched_entity *se)
> > +{
> > + if (se->parent)
> > + return group_cfs_rq(se->parent);
> > +
> > + return &cfs_rq_of(se)->rq->cfs;
>
> The function name and the description is not 100% correct. For tasks
> running naturally (not in a flattened taskgroup) in the root
> taskgroup
> or for the se representing a first level taskgroup (e.g. /tg1 (with
> se->depth = 0)) it returns the root cfs_rq or easier se->cfs_rq.
>
> So you could replace
>
> return &cfs_rq_of(se)->rq->cfs;
>
> with
>
> return se->cfs_rq;
>
> or
>
> return cfs_rq_of(se);

Good point. I will do that for the v2 series.


--
All Rights Reversed.

Attachment: signature.asc
Description: This is a digitally signed message part