[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKfTPtDHrA=YQ_Zm0wVJnwhdGAh14wXEm=HPWKU0UvSp_mpA4Q@mail.gmail.com>
Date: Wed, 30 Jan 2019 18:40:02 +0100
From: Vincent Guittot <vincent.guittot@...aro.org>
To: Peter Zijlstra <peterz@...radead.org>
Cc: linux-kernel <linux-kernel@...r.kernel.org>,
Ingo Molnar <mingo@...hat.com>, Tejun Heo <tj@...nel.org>,
Sargun Dhillon <sargun@...gun.me>
Subject: Re: [PATCH v2] sched/fair: Fix insertion in rq->leaf_cfs_rq_list
On Wed, 30 Jan 2019 at 15:27, Vincent Guittot
<vincent.guittot@...aro.org> wrote:
>
> On Wed, 30 Jan 2019 at 15:01, Peter Zijlstra <peterz@...radead.org> wrote:
> >
> > On Wed, Jan 30, 2019 at 03:01:04PM +0100, Peter Zijlstra wrote:
> > > --- a/kernel/sched/fair.c
> > > +++ b/kernel/sched/fair.c
> > > @@ -282,13 +282,15 @@ static inline struct cfs_rq *group_cfs_r
> > > return grp->my_q;
> > > }
> > >
> > > -static inline void list_add_leaf_cfs_rq(struct cfs_rq *cfs_rq)
> > > +static inline bool list_add_leaf_cfs_rq(struct cfs_rq *cfs_rq)
> > > {
> > > struct rq *rq = rq_of(cfs_rq);
> > > int cpu = cpu_of(rq);
> > >
> > > if (cfs_rq->on_list)
> > > - return;
> > > + return rq->tmp_alone_branch == &rq->leaf_cfs_rq_list;
> >
> > And I'm almost certain that can be: return true, but got my brain in a
> > twist.
>
> Yes this can return true
>
> If cfs_rq->on_list) then a child not already on the list used the path :
>
> if (cfs_rq->tg->parent &&
> cfs_rq->tg->parent->cfs_rq[cpu]->on_list) {
>
> which does rq->tmp_alone_branch = &rq->leaf_cfs_rq_list;
In fact tests show that we must keep:
return rq->tmp_alone_branch == &rq->leaf_cfs_rq_list;
Because the 1st sched_entity that will be used in the newly added
for_each_sched_entity loop, can be the sched_entityof the cfs_rq that
we just added in the list so cfs_rq->on_list == 1 but we must continue
to add parent
Apart from that, tests are ok
>
> >
> > > +
> > > + cfs_rq->on_list = 1;
> > >
> > > /*
> > > * Ensure we either appear before our parent (if already
Powered by blists - more mailing lists