[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160802112417.GH6862@twins.programming.kicks-ass.net>
Date: Tue, 2 Aug 2016 13:24:17 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: bsegall@...gle.com
Cc: linux-kernel@...r.kernel.org, stable@...r.kernel.org,
Andrey Ryabinin <aryabinin@...tuozzo.com>,
Chris Wilson <chris@...is-wilson.co.uk>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Mike Galbraith <efault@....de>,
Thomas Gleixner <tglx@...utronix.de>,
Yuyang Du <yuyang.du@...el.com>, kernel@...p.com,
morten.rasmussen@....com, pjt@...gle.com, steve.muckle@...aro.org,
Ingo Molnar <mingo@...nel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Subject: Re: [PATCH 4.4 043/146] sched/fair: Fix cfs_rq avg tracking underflow
On Mon, Jul 25, 2016 at 03:12:24PM -0700, bsegall@...gle.com wrote:
> > @@ -2690,15 +2707,15 @@ static inline int update_cfs_rq_load_avg
> >
> > if (atomic_long_read(&cfs_rq->removed_load_avg)) {
> > s64 r = atomic_long_xchg(&cfs_rq->removed_load_avg, 0);
> > - sa->load_avg = max_t(long, sa->load_avg - r, 0);
> > - sa->load_sum = max_t(s64, sa->load_sum - r * LOAD_AVG_MAX, 0);
> > + sub_positive(&sa->load_avg, r);
> > + sub_positive(&sa->load_sum, r * LOAD_AVG_MAX);
> > removed = 1;
> > }
> >
> > if (atomic_long_read(&cfs_rq->removed_util_avg)) {
> > long r = atomic_long_xchg(&cfs_rq->removed_util_avg, 0);
> > - sa->util_avg = max_t(long, sa->util_avg - r, 0);
> > - sa->util_sum = max_t(s32, sa->util_sum - r * LOAD_AVG_MAX, 0);
> > + sub_positive(&sa->util_avg, r);
> > + sub_positive(&sa->util_sum, r * LOAD_AVG_MAX);
> > }
> >
> > decayed = __update_load_avg(now, cpu_of(rq_of(cfs_rq)), sa,
> I missed this the first time around, and I have no problem with this
> backport, but it's not remotely obvious that update_cfs_rq_h_load() is
> intended to be something approaching racing-safe when not under
> rq->lock. (And given only somewhat-adversarial compilers I agree that it
> probably won't do any worse than skip updates, though I certainly won't
> swear to it)
Right, this is somewhat 'new' because we now use the avg load value for
the load-balancer, which is entirely unserialized.
Powered by blists - more mailing lists