Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp6105391ybi; Wed, 31 Jul 2019 08:25:45 -0700 (PDT) X-Google-Smtp-Source: APXvYqwRKI+F69mfyqE6ijd4KTdF014P1OhZeMwDuvkqa6Cg6UCNZ7+84SQ+kfDXj4CU//K0dUdb X-Received: by 2002:a63:2004:: with SMTP id g4mr109382852pgg.97.1564586745204; Wed, 31 Jul 2019 08:25:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564586745; cv=none; d=google.com; s=arc-20160816; b=CcE1jTOnv8xA5x1xVp/jr8CMB8FQ6HgnFvs7ExEAsWdYCGsIW1WTsxYx8r/Y87bCGk w1/4o6b/mSVSuAfMoSfremmwY3a6+I9LBmcalH20iuX3mlt0B478Lf9mge/3yxAQXnMY PyJI3UaeP4LT0WkRxulGFW2+pPZ9C/J6v25KrCvCD2b5yTJ/yTlJxTzYi6RtDD7kWAPg 2mQ78sq02GJziLhaT5RN/rp7UwXZZElVJScFKDxsVMeWk63lnx34VAFe/GJl2RCi9Y+I t+IwKSkml79D3chPHv3qbNDJW5vOWMH9zn+hKpYfZyzBCi7Zx1cy8vDKLyAqfOtnhN6J E+nA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:date:cc:to:from:subject:message-id; bh=hBCe60aoitXcYkSbsdZkJMO9enYY6RGflsI/UxigHic=; b=K/RG74DUnSXE1a1qfxob9AWGQonlKnwUytDBvZi9hha3L+7APIJJcb6zA2wIwFIFWD +yXxOQ4OZm6UE/tMJye/qhjRI0cegg9MkVilUAZ0AQ/3GhkubfcobbA5M/ziMBmETOad J0amSaUJVvS+hefkVJkJ+Ui+PEuRHknq7zPMmihwUKmQPcMH+85u3vGk51cwUcrrlzRB /aMPc7e4uGM264I8lxPbXNbbKfAYJnv8wGofFOoIbMqh39abJqEkgOX+H9THUmyNcEjb IiEh7/5pza7bmL196hNH7IUqSGkSVgejx6gXNt/DqKBfO2XKLYLIb4FmmSJN4/rRkLsA FDzQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l184si58935200pgd.203.2019.07.31.08.25.30; Wed, 31 Jul 2019 08:25:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388388AbfGaPDP (ORCPT + 99 others); Wed, 31 Jul 2019 11:03:15 -0400 Received: from shelob.surriel.com ([96.67.55.147]:45606 "EHLO shelob.surriel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388176AbfGaPDP (ORCPT ); Wed, 31 Jul 2019 11:03:15 -0400 Received: from imladris.surriel.com ([96.67.55.152]) by shelob.surriel.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92) (envelope-from ) id 1hsq85-0001Nv-Pn; Wed, 31 Jul 2019 11:03:01 -0400 Message-ID: <461f14cafabb7e6f78556f138b6aa619eff12dee.camel@surriel.com> Subject: Re: [PATCH 09/14] sched,fair: refactor enqueue/dequeue_entity From: Rik van Riel To: Peter Zijlstra Cc: linux-kernel@vger.kernel.org, kernel-team@fb.com, pjt@google.com, dietmar.eggemann@arm.com, mingo@redhat.com, morten.rasmussen@arm.com, tglx@linutronix.de, mgorman@techsingularity.net, vincent.guittot@linaro.org Date: Wed, 31 Jul 2019 11:03:01 -0400 In-Reply-To: <20190731093525.GH31425@hirez.programming.kicks-ass.net> References: <20190722173348.9241-1-riel@surriel.com> <20190722173348.9241-10-riel@surriel.com> <20190730093617.GV31398@hirez.programming.kicks-ass.net> <20190731093525.GH31425@hirez.programming.kicks-ass.net> Content-Type: multipart/signed; micalg="pgp-sha256"; protocol="application/pgp-signature"; boundary="=-oXa4WWI8f1hjsu/vRrww" User-Agent: Evolution 3.30.5 (3.30.5-1.fc29) MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --=-oXa4WWI8f1hjsu/vRrww Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, 2019-07-31 at 11:35 +0200, Peter Zijlstra wrote: > On Tue, Jul 30, 2019 at 11:36:17AM +0200, Peter Zijlstra wrote: > > On Mon, Jul 22, 2019 at 01:33:43PM -0400, Rik van Riel wrote: > > > +static bool > > > +enqueue_entity_groups(struct cfs_rq *cfs_rq, struct sched_entity > > > *se, int flags) > > > +{ > > > + /* > > > + * When enqueuing a sched_entity, we must: > > > + * - Update loads to have both entity and cfs_rq synced with > > > now. > > > + * - Add its load to cfs_rq->runnable_avg > > > + * - For group_entity, update its weight to reflect the new > > > share of > > > + * its group cfs_rq > > > + * - Add its new weight to cfs_rq->load.weight > > > + */ > > > + if (!update_load_avg(cfs_rq, se, UPDATE_TG | DO_ATTACH)) > > > + return false; > > > + > > > + update_cfs_group(se); > > > + return true; > > > +} > > No functional, but you did make update_cfs_group() conditional. Now > > that > > looks OK, but maybe you can do that part in a separate patch with a > > little justification of its own. >=20 > To record (and extend) our discussion from IRC yesterday; I now do > think > the above is in fact a problem. >=20 > The thing is that update_cfs_group() does not soly rely on the tg > state; > it also contains magic to deal with ramp up; for which you later > introduce that max_h_load thing. >=20 > Specifically (re)read the second part of the comment describing > calc_group_shares() where it explains the ramp up: >=20 > * The problem with it is that because the average is slow -- it was > designed > * to be exactly that of course -- this leads to transients in > boundary > * conditions. In specific, the case where the group was idle and we > start the > * one task. It takes time for our CPU's grq->avg.load_avg to build > up, > * yielding bad latency etc.. >=20 > (and further) >=20 > So by not always calling this (and not updating h_load) you fail to > take > advantage of this. >=20 > So I would suggest keeping update_cfs_group() unconditional, and > recomputing the h_load for the entire hierarchy on enqueue. I think I understand the problem you are pointing out, but if update_load_avg() keeps the load average for the runqueue unchanged (because that is rate limited to once a jiffy, and has been like that for a while), why would calc_group_shares() result in a different value than what it returned the last time? What am I overlooking? --=20 All Rights Reversed. --=-oXa4WWI8f1hjsu/vRrww Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- iQEzBAABCAAdFiEEKR73pCCtJ5Xj3yADznnekoTE3oMFAl1BraUACgkQznnekoTE 3oOxoAgAwFOZGyaVohHl1N71K7Sxs/txPqDCXWskwEsXf2FP2a74KXGMDifkyUR9 otdJ/c+UvL5e3rXRdLEjoJMvvuMRSITTY8Y95bysxnFpiChBBfmEfkR0+UWzqmmH rl+crbatn0Kh6HdENMtGfP2A2lyNApY2q42o1MB2oC0ktYFvIgtqR2z/WXpLMwEl ltg3zt35OaMAYQZ1JbpU2aHQdqW1IAqUwbwBWdp2w+hq3fNehLMhzazTGM2OvQp5 +nChB75ZAHHJcW0Dfs9WSU1HFT3q9nlEgS7/zTvhss6nh366eww5YRIjKxrAZqxQ Ks33MF8l9r9OXxlmjdxvygwxEvJe7g== =l4Jy -----END PGP SIGNATURE----- --=-oXa4WWI8f1hjsu/vRrww--