Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755480AbbG0DaK (ORCPT ); Sun, 26 Jul 2015 23:30:10 -0400 Received: from mail-pd0-f169.google.com ([209.85.192.169]:34515 "EHLO mail-pd0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754730AbbG0DaI (ORCPT ); Sun, 26 Jul 2015 23:30:08 -0400 Date: Mon, 27 Jul 2015 11:29:59 +0800 From: Boqun Feng To: Yuyang Du Cc: mingo@kernel.org, peterz@infradead.org, linux-kernel@vger.kernel.org, pjt@google.com, bsegall@google.com, morten.rasmussen@arm.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, umgwanakikbuti@gmail.com, len.brown@intel.com, rafael.j.wysocki@intel.com, arjan@linux.intel.com, fengguang.wu@intel.com Subject: Re: [PATCH v10 6/7] sched: Provide runnable_load_avg back to cfs_rq Message-ID: <20150727032959.GB3328@fixme-laptop.cn.ibm.com> References: <1436918682-4971-1-git-send-email-yuyang.du@intel.com> <1436918682-4971-7-git-send-email-yuyang.du@intel.com> <20150721010346.GA2882@fixme-laptop.cn.ibm.com> <20150721004400.GA28512@intel.com> <20150721101845.GB2882@fixme-laptop.cn.ibm.com> <20150721102956.GA5380@fixme-laptop.cn.ibm.com> <20150726184325.GB28512@intel.com> <20150727032114.GA3328@fixme-laptop.cn.ibm.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="5vNYLRcllDrimb99" Content-Disposition: inline In-Reply-To: <20150727032114.GA3328@fixme-laptop.cn.ibm.com> User-Agent: Mutt/1.5.23+102 (2ca89bed6448) (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3609 Lines: 109 --5vNYLRcllDrimb99 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Jul 27, 2015 at 11:21:15AM +0800, Boqun Feng wrote: > Hi Yuyang, >=20 > On Mon, Jul 27, 2015 at 02:43:25AM +0800, Yuyang Du wrote: > > Hi Boqun, > >=20 > > On Tue, Jul 21, 2015 at 06:29:56PM +0800, Boqun Feng wrote: > > > The point is that you have already tracked the sum of runnable_load_a= vg > > > and blocked_load_avg in cfs_rq->avg.load_avg. If you're going to track > > > part of the sum, you'd better track the one that's updated less > > > frequently, right? > > >=20 > > > Anyway, this idea just comes into my mind. I wonder which is udpated > > > less frequently myself too. ;-) So I ask to see whether there is > > > something we can improve. > >=20 > > Actually, this is not the point. > >=20 > > 1) blocked load is more "difficult" to track, hint, migrate. > >=20 > > 2) r(t1) - b(t2) is not anything, hint, t1 !=3D t2 >=20 > Please consider this patch below, which is not tested yet, just for > discussion. This patch is based on 1-5 in your patchset and going to > replace patch 6. Hope this could make my point clear. >=20 > Thanks anyway for being patient with me ;-) >=20 > Regards, > Boqun >=20 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >=20 > Subject: [PATCH] sched: lazy blocked load tracking >=20 > With this patch, cfs_rq_runnable_load_avg can be implemented as follow: >=20 > static inline unsigned long cfs_rq_runnable_load_avg(struct cfs_rq *cfs_r= q) > { > u64 now =3D cfs_rq_clock_task(cfs_rq); > decay_cfs_rq_blocked_load(now, cfs_rq); >=20 > return max_t(long, cfs_rq->avg.load_avg - cfs_rq->blocked_load_avg, 0); > } >=20 > --- > kernel/sched/fair.c | 41 +++++++++++++++++++++++++++++++++++++++++ > kernel/sched/sched.h | 4 ++++ > 2 files changed, 45 insertions(+) >=20 > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c > index e977074..76beb81 100644 > --- a/kernel/sched/fair.c > +++ b/kernel/sched/fair.c > @@ -2625,6 +2625,20 @@ static __always_inline int __update_load_avg(u64 n= ow, int cpu, > return decayed; > } > =20 > +static inline u64 decay_cfs_rq_blocked_load(u64 now, struct cfs_rq *cfs_= rq) > +{ > + u64 decays; > + > + now =3D now >> 20; > + decays =3D now - cfs_rq->last_blocked_load_decays; > +=09 > + cfs_rq->blocked_load_sum =3D decay_load(cfs_rq->blocked_load_sum, decay= s); > + cfs_rq->blocked_load_avg =3D div_u64(cfs->blocked_load_sum, LOAD_AVG_MA= X); > + cfs_rq->last_blocked_load_update_time =3D now; Sorry for the typo, should be last_blocked_load_decays here ;-) Regards, Boqun --5vNYLRcllDrimb99 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAABCAAGBQJVtaWyAAoJEEl56MO1B/q4qLUIAKQ2RBqLWfnulGxttdcsMQcU FvW+0wd6+YimPVDOlVtUq58vkBOy5EDLFcO69gn9tf2bYtflqm5P6C/QbPfGdasf URchG4hraUJ9hCKo4FJSHWHf+QT+35/dkf+TaM1QJF1en9zMPA/VVunax8szKnYL Xfthpihg+Lott602aJfnRv5skzkyYrSNpVvkNuuV23ggASAbsPB5oacl8nPzcRq/ tPWBaUMxsY9zjddDz4eTJ4ZyNkVscvpZ2OpUzyWKhYTJMvH97uw4pYuUShI/bxyH Tjtxlt44mWQVWRQQCQS4XIjbmY7FSNDRvpwcKNNidIfyQzQJYeXJLgFnGVh7/Qk= =iGyY -----END PGP SIGNATURE----- --5vNYLRcllDrimb99-- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/