Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp5821546ybi; Wed, 31 Jul 2019 03:57:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqxRkdfcQ4hUQqBtadNxQpl6LuQoRJ4nAsEPZQMI/aYqqMxMaYiIxy7fO8qTVjfeeVfC1s+B X-Received: by 2002:a65:6104:: with SMTP id z4mr75345541pgu.27.1564570620920; Wed, 31 Jul 2019 03:57:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564570620; cv=none; d=google.com; s=arc-20160816; b=WhhsbgNY7yWGQVutG4pHPUDtz+cTgrQhDhaxLt6TfegO4ZmTI9hU6PzFqcz8osx4ot 1iUiyq8D3WG+bvf4VU4hDFx0ypwHb1AeoAxFJm2x91Ji/kwCGPvxpiLySjJpL2L9ztE3 xCtf76AWhHUrZU+hxQhbt9YJentAORdUt5C97GaqeNsJJyJJHMHBVf2XMXAnwvKijMix Uw/CCCK4T9SYPvxg8+uEtPP4ygWcX+h7vrfvav4iXeKO8jgKSrU4JHQRi+2u9fs7JWY2 ipr7e2b0Gf9YPefw85H0Ds1xsZzNQ5ZsHCCO6hFjTVTKP9mUPsMUkR+VXwKTbeUqq/hY FU1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=zJoP3Rg2fAIDmBPa+QFXOhQhKDK0+45L1xRuX7JQPgU=; b=jYiJQEzDtRlwKbMqsGhzWan6zELTuspZnlX6XGNo2cSdQmHo4btjGNoUGk0zDPjjqP BHOSCw5OIn0d2qZ2dxipuCtnNFxVVS9au8FRrH4CDFFtg8DRkJH18+uzZvKP95U16Bf0 pOBAahTO57V6q8r5aOORE5UQ2WA0e31BsnYLZFuR7kRO/tPuiX95HlZpBe4SQXETDYFj +JNSX+yen7fwpbrLuL51OGvcEZeZaLfYGmaMcF9Wivy6C237d+5c555vJ6vXO1ObsRdq 3x1lCR9FtJeg9aAe1Et/DW+kNQUdIFWP/n6kHGa3a/LsgKC3V6+ixnI8QLPqR915rLyp aMBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=ZAzihXzP; 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 y8si30655983pgv.541.2019.07.31.03.56.45; Wed, 31 Jul 2019 03:57:00 -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; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=ZAzihXzP; 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 S1728332AbfGaJfl (ORCPT + 99 others); Wed, 31 Jul 2019 05:35:41 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:60052 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726463AbfGaJfk (ORCPT ); Wed, 31 Jul 2019 05:35:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=zJoP3Rg2fAIDmBPa+QFXOhQhKDK0+45L1xRuX7JQPgU=; b=ZAzihXzPUv9OGfnAq5ECib+Jw Z502cCgNGjSsVNNP2hHOMyZQJoz+OhuOXaS4+xcCVecnaaQSIJkb5DcqKZsEx3rVZM1TN/B1N3Df9 xYQAX0BnGjynhMfc7h7A2sCWwDXW9Z2Eu6t5o3MUlPrWGIUhasrDLGSDxEOyLR+SgN7XjYA5LhRNv wjG/iN86Ivp350AQBoIq1BvXKERlARWZk+yd6DZojiKJ3VC9L/i/L6Gw5FcOOMBV+XGflhcicysJK 3QAVNrSe+tDGU4KTGLMQaOTWraGKXVi/LpRgZPJjux+9kZQdE+be2IlKc26njDADIJB9hdjbaRzFM omruSilKA==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.92 #3 (Red Hat Linux)) id 1hsl15-0007MJ-SR; Wed, 31 Jul 2019 09:35:28 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 052EA2029FD58; Wed, 31 Jul 2019 11:35:26 +0200 (CEST) Date: Wed, 31 Jul 2019 11:35:25 +0200 From: Peter Zijlstra To: Rik van Riel 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 Subject: Re: [PATCH 09/14] sched,fair: refactor enqueue/dequeue_entity Message-ID: <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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190730093617.GV31398@hirez.programming.kicks-ass.net> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. To record (and extend) our discussion from IRC yesterday; I now do think the above is in fact a problem. 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. Specifically (re)read the second part of the comment describing calc_group_shares() where it explains the ramp up: * 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.. (and further) So by not always calling this (and not updating h_load) you fail to take advantage of this. So I would suggest keeping update_cfs_group() unconditional, and recomputing the h_load for the entire hierarchy on enqueue.