[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMZfGtXjvKdKUVtNKWqLd01PATArMezumm+gX+edLXuRtQ6eiA@mail.gmail.com>
Date: Mon, 13 Apr 2020 23:00:04 +0800
From: 宋牧春 <songmuchun@...edance.com>
To: Benjamin Segall <bsegall@...gle.com>, mingo@...nel.org,
peterz@...radead.org, juri.lelli@...hat.com,
Vincent Guittot <vincent.guittot@...aro.org>
Cc: linux-kernel@...r.kernel.org, dietmar.eggemann@....com,
rostedt@...dmis.org, mgorman@...e.de
Subject: Re: [External] Re: [PATCH] sched/fair: Fix call walk_tg_tree_from()
without hold rcu_lock
On Tue, Apr 7, 2020 at 2:17 AM <bsegall@...gle.com> wrote:
>
> Muchun Song <songmuchun@...edance.com> writes:
>
> > The walk_tg_tree_from() caller must hold rcu_lock, but the caller
> > do not call rcu_read_lock() in the unthrottle_cfs_rq(). The
> > unthrottle_cfs_rq() is used in 3 places. There are
> > distribute_cfs_runtime(), unthrottle_offline_cfs_rqs() and
> > tg_set_cfs_bandwidth(). The former 2 already hold the rcu lock,
> > but the last one does not. So fix it with calling rcu_read_lock()
> > in the unthrottle_cfs_rq().
>
> It might be a tiny bit better to put it in the tg_set_cfs_bandwidth
> instead, but the other two sources were kinda by accident, so this is
> reasonable too.
>
> Reviewed-by: Ben Segall <bsegall@...gle.com>
>
> >
> > Signed-off-by: Muchun Song <songmuchun@...edance.com>
> > ---
> > kernel/sched/fair.c | 2 ++
> > 1 file changed, 2 insertions(+)
> >
> > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> > index 6f05843c76d7d..870853c47b63c 100644
> > --- a/kernel/sched/fair.c
> > +++ b/kernel/sched/fair.c
> > @@ -4782,7 +4782,9 @@ void unthrottle_cfs_rq(struct cfs_rq *cfs_rq)
> > raw_spin_unlock(&cfs_b->lock);
> >
> > /* update hierarchical throttle state */
> > + rcu_read_lock();
> > walk_tg_tree_from(cfs_rq->tg, tg_nop, tg_unthrottle_up, (void *)rq);
> > + rcu_read_unlock();
> >
> > if (!cfs_rq->load.weight)
> > return;
Ping guys?
--
Yours,
Muchun
Powered by blists - more mailing lists