Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp182646ybf; Wed, 26 Feb 2020 11:05:36 -0800 (PST) X-Google-Smtp-Source: APXvYqzX/q+EFJcVyE2xc2HwIm2yy/LX1mftHBC/iL7uC+2HUvK3T24sP47kLgqGoBvR6hmepccv X-Received: by 2002:a9d:1c9c:: with SMTP id l28mr215050ota.210.1582743936376; Wed, 26 Feb 2020 11:05:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582743936; cv=none; d=google.com; s=arc-20160816; b=H5OKr7WyA7FONMCNZVSInt+UMm33M/JERJFNiMDf2PppwCV8LyafEkAwtBfzVUykXO YEwF6mx38DcjYekS8AorQ+n2Q15ccWWCwUbqt4J4NjWWIJV6zR8zV9Zrg/qzccc41QJb e46IQOwZTcxUtRpgWdwIrb9uqoWHmvvnvGmmbOkwAOWQPgg4HpyiQzJTivQMAZ5FohrJ JhTF0x6Sg/KuwFBjUZvreYy3mcn8CHGUXPw0aXp7OK2d6EGFwH7DXo62FdccEbT9L24K 4IrRhrhCWfnvLaYckIfxMgKE6bOz5hhiCzszZaS7hW9OhkALJ49h06zlGJKCAydxFQF3 J7VQ== 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:message-id :in-reply-to:date:references:subject:cc:to:from:dkim-signature; bh=t4Ymq0wxAYLuYTgvSM3hAABbndMMrFALAZeqIqFcSao=; b=ORqD/7BEQoaC//fXePPW5UKTSbc8y1oMahUgkmAzXTNGN/CmUifR/xCZDi4NPw5+I0 Gipo/sHN2OOQZd3Np8poB1JSqcRqPuEzWOg21XTszpnC9xgtJd01q/qFnUWQwwbogpQC R1g+YQKsX/OFX7SwRcgf50ZsuEQuSRTXr1HF+cIDjOpw99TFDkjarMG2On6eNhK8Fx0d kX75obi2Ja2zFeYIFdwGlqwEj2E1P1yAVC3PZz7X7FB/W8rc/nXAtkVPwOxcTKwBvQ8I fk/7KT7Da8JtXQ33YMPPIIfYukjbQ26SNXlEvjZc6Oy/YKV8FhTRlrDrLUqHo/nZ6PZA +UxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=OOvVEIuQ; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s129si84007oig.177.2020.02.26.11.05.20; Wed, 26 Feb 2020 11:05:36 -0800 (PST) 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=pass header.i=@google.com header.s=20161025 header.b=OOvVEIuQ; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727073AbgBZTEo (ORCPT + 99 others); Wed, 26 Feb 2020 14:04:44 -0500 Received: from mail-pg1-f193.google.com ([209.85.215.193]:42566 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726996AbgBZTEo (ORCPT ); Wed, 26 Feb 2020 14:04:44 -0500 Received: by mail-pg1-f193.google.com with SMTP id h8so109290pgs.9 for ; Wed, 26 Feb 2020 11:04:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=t4Ymq0wxAYLuYTgvSM3hAABbndMMrFALAZeqIqFcSao=; b=OOvVEIuQQnOlnqpJCPs6X9Bp9f6QZ4KOBED/1NBLO3umkCEpjHrC1Ui+ywDpXyEcM1 QOe2BnC7DMY/3mBdN4q8kOecW66G4YXoO8xjjJ8RDPNkdJLLFL70D3/g8XGSXa5wGemf O6BRp0MtFRAy71cqNc2kdIRpnx3R+E6BsLhkymL4mqCfnixOcs92uDS8d9FeX1aE0Ska clYmF5+MgiRxVK5X/S6FcKhFtUSy3pStKZWpj7Q7AuljBlL8DFAMnm+UjjveU4JdtBNF FNXLFYYWdOCvX4faeVi9OeU+85e1Ew4fG56yBOBClGM9fwfaFJT47Td5Qgg1orvB76WV m6Zw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=t4Ymq0wxAYLuYTgvSM3hAABbndMMrFALAZeqIqFcSao=; b=YsusvpUGlD4vTg1iZgFPcFhH7grY852YcTGZrgh2dsblBYR9gIO7xWBKP2dkqG1S1t XTUnnlsO8edjA90A7CAO+vwBSYlGV/h+yEdmF35mkTexUbmBxvSYFELAos1t0Hrbl6j/ 62No2/vRqKAs43y9oebkcl/XGMQzlgp8UduJz7COm3X3MGQG9dDMG4k1F4IedBNJzCZB W6DSpAoOQ55KSLCgdu2drsyFxFm68lw1kwo4/By4SIKpWlpFthiaJ29NWH16YBjEd7i7 9vbOxYetSdkBenq0ydMZ/IrNO6fg45+QCCvymw5b98IZ46V1kMbpe2g0E+jUzLVMpXlA 4qFQ== X-Gm-Message-State: APjAAAX3WBIB0lvv+pFOaQDGV4hGL6UqVMMLbA9ItER3wuCdS4hJhnfi OKN+Or4YfIhR6GjpPc9CNtM3eQ== X-Received: by 2002:a62:52d0:: with SMTP id g199mr100564pfb.241.1582743883050; Wed, 26 Feb 2020 11:04:43 -0800 (PST) Received: from bsegall-linux.svl.corp.google.com.localhost ([2620:15c:2cd:202:39d7:98b3:2536:e93f]) by smtp.gmail.com with ESMTPSA id p17sm3840362pfn.31.2020.02.26.11.04.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Feb 2020 11:04:42 -0800 (PST) From: bsegall@google.com To: Vincent Guittot Cc: mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, linux-kernel@vger.kernel.org, pauld@redhat.com, parth@linux.ibm.com, valentin.schneider@arm.com, hdanton@sina.com, zhout@vivaldi.net Subject: Re: [PATCH] sched/fair: fix runnable_avg for throttled cfs References: <20200226181640.21664-1-vincent.guittot@linaro.org> Date: Wed, 26 Feb 2020 11:04:40 -0800 In-Reply-To: <20200226181640.21664-1-vincent.guittot@linaro.org> (Vincent Guittot's message of "Wed, 26 Feb 2020 19:16:40 +0100") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Vincent Guittot writes: > When a cfs_rq is throttled, its group entity is dequeued and its running > tasks are removed. We must update runnable_avg with current h_nr_running > and update group_se->runnable_weight with new h_nr_running at each level > of the hierarchy. You'll also need to do this for task enqueue/dequeue inside of a throttled hierarchy, I'm pretty sure. > > Fixes: 9f68395333ad ("sched/pelt: Add a new runnable average signal") > Signed-off-by: Vincent Guittot > --- > This patch applies on top of tip/sched/core > > kernel/sched/fair.c | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c > index fcc968669aea..6d46974e9be7 100644 > --- a/kernel/sched/fair.c > +++ b/kernel/sched/fair.c > @@ -4703,6 +4703,11 @@ static void throttle_cfs_rq(struct cfs_rq *cfs_rq) > > if (dequeue) > dequeue_entity(qcfs_rq, se, DEQUEUE_SLEEP); > + else { > + update_load_avg(qcfs_rq, se, 0); > + se_update_runnable(se); > + } > + > qcfs_rq->h_nr_running -= task_delta; > qcfs_rq->idle_h_nr_running -= idle_task_delta; > > @@ -4772,6 +4777,11 @@ void unthrottle_cfs_rq(struct cfs_rq *cfs_rq) > cfs_rq = cfs_rq_of(se); > if (enqueue) > enqueue_entity(cfs_rq, se, ENQUEUE_WAKEUP); > + else { > + update_load_avg(cfs_rq, se, 0); > + se_update_runnable(se); > + } > + > cfs_rq->h_nr_running += task_delta; > cfs_rq->idle_h_nr_running += idle_task_delta;