Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp141780ybf; Wed, 26 Feb 2020 10:17:20 -0800 (PST) X-Google-Smtp-Source: APXvYqztvF8xfi0dcx1D7xfCw5n5hTrP6yjSKUKOUXqtlk9tMP+v3Fn8xQzR/PVf3/RInOCj3KBM X-Received: by 2002:a05:6830:1e0e:: with SMTP id s14mr70622otr.90.1582741040636; Wed, 26 Feb 2020 10:17:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582741040; cv=none; d=google.com; s=arc-20160816; b=DBy7WM73ZPHKOXy+Xg7nbjnYNjQIjI+CddX1S6c88en/ejEMymNnm3FGejZLUe9LOc pftVvD4GbIPUs3H2P/7DoPg3Jn4a3X2NsJmDH6/1BBXqcsjZ/HAi0RZ5cNOiXihidoxX zk2Ngj6fE+T5CX9W4/kuVyh5QtE6BqE3Tjf76FlqmdVYoOdS5/xmmN++SQynZEiQM5db Ewfye/JNl7J1cphJKEswiwndNRfBxGDADdL4xNYpioyqaCYpYBG8vhHJpHcIITGCSMpD KKl5UFj6M+keC4rCj0EAloIVb7i3cMvtn8G3LSpj7ehGk+x3GQicvztmu3DGh8p8hf2H W54Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=kEtj9OGTr22Vks60ZU1zaux1zdrNeTID9OslwV15BQc=; b=tAMaiOmImeSHWRxjOYtt9J/vbJU9+Sr+nCtVFqC2rzUKEp9c7nxKS/esgQVeuE9FrE nxibQXA4xkViXFo1mi7wetBLtpPBjkCzgpYwX1xOTRCXVkSZaOAf6iHoV4yc3nSSS8Ad 2Kk5tDeFO2/TGStoQJhQSgvX3XArswIABK6DONzvBvbvf3RswLgUvPwr+vUXEHQMYvEg ms7ar5D+L5o+HhlnQyZdG5x3sfXqOk71NJHnknxtq/3eiU4DJK2xNigWFQBEcybPO0Rl s5lLaSDITsRLB50VLSwTNjcCvom4EcTGPgmBq3ReLcZKNsrC0HG87YxQEHr2b4HxD1ju WIcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mieIz9k9; 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=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 24si16022oiz.237.2020.02.26.10.17.07; Wed, 26 Feb 2020 10:17:20 -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=@linaro.org header.s=google header.b=mieIz9k9; 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=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727009AbgBZSQr (ORCPT + 99 others); Wed, 26 Feb 2020 13:16:47 -0500 Received: from mail-wm1-f68.google.com ([209.85.128.68]:34177 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726787AbgBZSQr (ORCPT ); Wed, 26 Feb 2020 13:16:47 -0500 Received: by mail-wm1-f68.google.com with SMTP id i10so4046153wmd.1 for ; Wed, 26 Feb 2020 10:16:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=kEtj9OGTr22Vks60ZU1zaux1zdrNeTID9OslwV15BQc=; b=mieIz9k96KerE+V4iKD3mwJJ9CtVbovh3AcH1YTnH/svnH8IERTtlP9pq8kZuSgKgN UYyfVA5vNoNMNZ5wv/kd/H1PNmQdCfS+GUPRaGgcsgNp1MpdQ1xXGnMkCJXxlPaGsht+ MdgB2MAGozpwE1ElszKlmfn+SNC6N5wTV1TZB7bu69q+/0qEwIWIWn1kUGL0NKW7OGn6 rdv+pMIBFL/nXIjm5q2wVLMru2IwuJ0lfFkNBvCz+lo2wWTePsLRDYdaL0aGidXSs4+l +HpaWU+odZf6j3UrLHKJuYF7unHeeDAfd6V1svihXv9S6lGefieRP/QRAWVICPJcf8Ei /1tw== 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:date:message-id; bh=kEtj9OGTr22Vks60ZU1zaux1zdrNeTID9OslwV15BQc=; b=e2h0l4knpi+z1PTHCqOo9vrIzNeobasfry86cAsTiXOn63YqvjqotB9HI6XD/GrX4b sVO+3+OzRxwLP7qwVHPqUmg2gAvzc8L/RYQfsOkT3ieuVyPWMAJwk5ZLSn95fB2wcDI7 EleI8iFONKJCCDWJnsr5cmggRe9xjRSd22ubteyZ/zo7EBV73Kgf5Z0QmwCUIOFrYlXG vMAdMbcg/ZHZhLHM3Z+mNeWlTx13W9gnFnLlEmDBsYPr9/f6olydB36LeddRGnPnrB+7 Ywr0/dt1l6LitpOsSCbM+TEUR0kLeWeM5k7xe4p/4UCn2p602cGtGgnRe8yeJFfs/DLk BQPw== X-Gm-Message-State: APjAAAUBUWShJsXYYiGL93mxyaAWOAvKEop6rSUaFLW/zu4JhSjFfQm9 5Q4W6rB5tVy4Khy+cEbNYAJQLw== X-Received: by 2002:a05:600c:291d:: with SMTP id i29mr134558wmd.39.1582741004862; Wed, 26 Feb 2020 10:16:44 -0800 (PST) Received: from localhost.localdomain ([2a01:e0a:f:6020:41b:487e:9055:34c1]) by smtp.gmail.com with ESMTPSA id o3sm4644638wme.36.2020.02.26.10.16.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Feb 2020 10:16:43 -0800 (PST) From: Vincent Guittot To: 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 Cc: pauld@redhat.com, parth@linux.ibm.com, valentin.schneider@arm.com, hdanton@sina.com, zhout@vivaldi.net, Vincent Guittot Subject: [PATCH] sched/fair: fix runnable_avg for throttled cfs Date: Wed, 26 Feb 2020 19:16:40 +0100 Message-Id: <20200226181640.21664-1-vincent.guittot@linaro.org> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. 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; -- 2.17.1