From patchwork Tue Feb 6 08:32:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Guittot X-Patchwork-Id: 126958 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp2705930ljc; Tue, 6 Feb 2018 00:33:05 -0800 (PST) X-Google-Smtp-Source: AH8x226XcFZ8AjsXfcNKuYnETvSTjvr1AlwECuFTGAsBfPtweZenq/fqge78KxwhHTrxe0RILSc7 X-Received: by 10.99.127.84 with SMTP id p20mr1349740pgn.330.1517905984872; Tue, 06 Feb 2018 00:33:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517905984; cv=none; d=google.com; s=arc-20160816; b=gHNtjspCOQ6xLDJT5ijyET/cNajVTelYP8dPUePaHXYnfVngIInWk6bHl5AzIz6uHF ltv/SxPb/9DsglebPsyX95qPLPzqIDKUY0Nj0GpL7rhQ9MAVl8neVR1JBN35v2YuNOwe leKYUZakqmdOmTFTJG7UE0F3XRJ9Kz3PSfVidIl9BGOsQoxzxfYuDcFUm8IkM75jv4Z3 4ATNkfLHV89hRLa+Y6giH155nPy+2ZlAfQYIe9WpmgqqVcqrpba5rwIAtfiamJYzf5GX rwKemecMJXtFeuWx5xdsza4Jn80Kh0zXTGciMW7slvW1pXpKppXu7Sr9MRSKKoEP558o 8k7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=BAbX34IIoXTVnoYDtljQur2ziv/71IJtcwHPYfVrduk=; b=Xxqpz8bc6SVLkmjqU6VdJ6Gj1QJ2uORBGFQl95gafrlz2pIPpZLORkwWO8wCIYm4f/ TjItxp+rPxJZi6O0fBKc7Iz6Upy1tnqtYdVMhecprYwGgBJ7RVJsF18v8fQbOS+JGGZ5 to5CpZMWvmCcxM/JLSpQ0/IFoTzQx09oUu1e5LMxsF1jYeoDJoxwsn26eWs1UZz9ORlA MFEb9cWsoZYGss/3s+hvNB8CAcy4VAu8OPEWk6RamQ74t9npuGq8xUxXBwl5caKO4j5D iaLKUiR5+W+5IlqqezLYvLkjQhc/DReEjishMlRKoF/gFfbYWgfwGFPjZsgAIOA3n7Nh fHZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gbWqSAWz; 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 m23si1647716pgc.438.2018.02.06.00.33.04; Tue, 06 Feb 2018 00:33:04 -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=gbWqSAWz; 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 S1752544AbeBFIdC (ORCPT + 22 others); Tue, 6 Feb 2018 03:33:02 -0500 Received: from mail-wm0-f67.google.com ([74.125.82.67]:37778 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752155AbeBFIcl (ORCPT ); Tue, 6 Feb 2018 03:32:41 -0500 Received: by mail-wm0-f67.google.com with SMTP id v71so2089970wmv.2 for ; Tue, 06 Feb 2018 00:32:41 -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:in-reply-to:references; bh=BAbX34IIoXTVnoYDtljQur2ziv/71IJtcwHPYfVrduk=; b=gbWqSAWz6k7f4Z5uAuKD74/X7NI+TD1ubo9M5r/gVPbyPnb5sbpt/99ykKSdaSHAf5 SXjSkLzv9UjxJcKuTKCdtVYO3Fj1Aib7bn1KBL05V5CAAnA67pODcmS16Nrk/EQq6pNq NdTWNO4w0mUPXZBzGRCIL4+koyvUW2yeT6ECA= 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:in-reply-to :references; bh=BAbX34IIoXTVnoYDtljQur2ziv/71IJtcwHPYfVrduk=; b=gYucxoSNONnBl4BQfUXevFvjWkxVq144wCB/GRxoclHvXcKKq2DgrbNgC1eLnQfg4v Mtj2l0kr9vcA1off3vP7nz2yMXvDSOrq8bOZmf8zhDOPR7vC0iDBd+HqFydB8rY0Ojjt 5wot3qb7DQZMVe6KPlke7H25KQBQJa/sbTCMsEX42lztUnjaxOevPWHCmrZ4523p4GxM /IvrJR+1/8MaPvhecV/fM1PZDpzkk2IZ4pybSP7mxMUKBiHz3JG/ghrz8gb9HwYDr/0d yZJneST84UD5Vvo32ua3awwX2gfmL108SceZk7wAkvnR4B68L+D/UxNt+NqH81boI0xs 8Quw== X-Gm-Message-State: APf1xPBh0T6y2JQQl719ufdpH1u2bDd79U9ay8Gp6UhIMykp82yg6/DL /ywvDFUh3HP00QwbkRp0beyEbQ== X-Received: by 10.80.175.162 with SMTP id h31mr2820615edd.48.1517905960706; Tue, 06 Feb 2018 00:32:40 -0800 (PST) Received: from localhost.localdomain ([2a01:e0a:f:6020:e179:d82f:e215:d936]) by smtp.gmail.com with ESMTPSA id k42sm9119601edb.44.2018.02.06.00.32.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 06 Feb 2018 00:32:39 -0800 (PST) From: Vincent Guittot To: peterz@infradead.org, mingo@kernel.org, linux-kernel@vger.kernel.org, valentin.schneider@arm.com Cc: morten.rasmussen@foss.arm.com, brendan.jackman@arm.com, dietmar.eggemann@arm.com, Vincent Guittot Subject: [PATCH 2/3] sched: reduce the periodic update duration Date: Tue, 6 Feb 2018 09:32:22 +0100 Message-Id: <1517905943-24528-2-git-send-email-vincent.guittot@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1517905943-24528-1-git-send-email-vincent.guittot@linaro.org> References: <20180201181041.GF2269@hirez.programming.kicks-ass.net> <1517905943-24528-1-git-send-email-vincent.guittot@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Instead of using the cfs_rq_is_decayed() which monitors all *_avg and *_sum, we create a cfs_rq_has_blocked() which only takes care of util_avg and load_avg. We are only interested by these 2 values which are decaying faster than the *_sum so we can stop the periodic update earlier. Signed-off-by: Vincent Guittot --- kernel/sched/fair.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) -- 2.7.4 diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 279f4b2..6998528 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -7337,6 +7337,19 @@ static void attach_tasks(struct lb_env *env) rq_unlock(env->dst_rq, &rf); } +static inline bool cfs_rq_has_blocked(struct cfs_rq *cfs_rq) +{ + if (cfs_rq->avg.load_avg) + return true; + + if (cfs_rq->avg.util_avg) + return true; + + return false; +} + +#ifdef CONFIG_FAIR_GROUP_SCHED + static inline bool cfs_rq_is_decayed(struct cfs_rq *cfs_rq) { if (cfs_rq->load.weight) @@ -7354,8 +7367,6 @@ static inline bool cfs_rq_is_decayed(struct cfs_rq *cfs_rq) return true; } -#ifdef CONFIG_FAIR_GROUP_SCHED - static void update_blocked_averages(int cpu) { struct rq *rq = cpu_rq(cpu); @@ -7391,7 +7402,9 @@ static void update_blocked_averages(int cpu) */ if (cfs_rq_is_decayed(cfs_rq)) list_del_leaf_cfs_rq(cfs_rq); - else + + /* Don't need periodic decay once load/util_avg are null */ + if (cfs_rq_has_blocked(cfs_rq)) done = false; } @@ -7461,7 +7474,7 @@ static inline void update_blocked_averages(int cpu) update_cfs_rq_load_avg(cfs_rq_clock_task(cfs_rq), cfs_rq); #ifdef CONFIG_NO_HZ_COMMON rq->last_blocked_load_update_tick = jiffies; - if (cfs_rq_is_decayed(cfs_rq)) + if (!cfs_rq_has_blocked(cfs_rq)) rq->has_blocked_load = 0; #endif rq_unlock_irqrestore(rq, &rf);