From patchwork Tue Feb 6 19:23:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Guittot X-Patchwork-Id: 127081 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp3208729ljc; Tue, 6 Feb 2018 11:24:03 -0800 (PST) X-Google-Smtp-Source: AH8x224/UX8oMrYas1nBcYZyCDSEnchvQ0lhWm0A7/+fnO8H8OHblo4op77Ge+tVFS2U1gBz1mdO X-Received: by 10.98.31.70 with SMTP id f67mr3441263pff.196.1517945043071; Tue, 06 Feb 2018 11:24:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517945043; cv=none; d=google.com; s=arc-20160816; b=DK6LgfUmTG/zh93bJ5/Yx0ELSCdjpm21ni+veaLSIiIE5uNBGPXiPLSjElG91H34d7 6538MxhOHzOCWTM+ka2Xz0dDF1IxbI7WqwQJnfFHbpQS9nVC1mKM+FTb2NsKGGhf0MGL X/Twil2uJV8TsPMQKRWboTIZKuj45GL3G+Dy+MeOwmmCDhTLFUTd/NcDLWNeF8ql/y/n wKpN1997auVszkBH38fAHmgjaH21rLWi1d+rjDgN5u8rG0pljTstvs3J3n5yrcfNB6vN Ats5li0qlMkyJ02/Ktvbg2Tk674rLpAk2yFfZPljZSd3Si+v1UvciaFnr45iA+OIiau3 eDTA== 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=fc4hgkQE9XHngMAbtECDPNkh8BUWa9POuhBW2Vv1f1Y=; b=yQa0d/APjuiGH6Vjz+4h5VRHLZCgw1dsjpCbgt4LvzufAHtT8mTbvkBBO5UXfVMO82 Mb1miME2phK7L4aeewbxAbeOAPqeB5zqywU8QttIjJOf6z5/k8yTa9RfSTlBfPry1JPH uC14xRgSnFHmtKTNAGGwXzz7U2k7cfkRKWRHmwDgJgtvoJtzecy0Jzyu6ucP5GTD306t aKwBX1+DZ+pcp29K+MJ+KWBe0rCQG0xwXmxO5IdiCWaKpgeVapBFMeflIosoP/lnB6c8 Ri4obmZtY53Ex/oILjRQ/jYd+f0VTFseT+UPMe1P/t0nipefYpK3TnGFHHWda4Ofqt8D WaHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bwl9mKLg; 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 y3si447208pgo.193.2018.02.06.11.24.02; Tue, 06 Feb 2018 11:24:03 -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=bwl9mKLg; 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 S1753055AbeBFTXZ (ORCPT + 18 others); Tue, 6 Feb 2018 14:23:25 -0500 Received: from mail-wm0-f66.google.com ([74.125.82.66]:37764 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752884AbeBFTXW (ORCPT ); Tue, 6 Feb 2018 14:23:22 -0500 Received: by mail-wm0-f66.google.com with SMTP id v71so6049745wmv.2 for ; Tue, 06 Feb 2018 11:23:21 -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=fc4hgkQE9XHngMAbtECDPNkh8BUWa9POuhBW2Vv1f1Y=; b=bwl9mKLgEJbVPhA9eNvFJGyHkM3TQGO2zz+YTvjZa6CPFXZ8qCHoOkNGt8NKJ9846m eCDE+aUTmTiUzUGOahHBNyhy6Q0ja1hiLjtSU4nIj+JY/LZFHcSBTU13w4saLSKZBKGi haO3HT22JPD0Bukw3ROS9gOwE/GhBgd28etBw= 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=fc4hgkQE9XHngMAbtECDPNkh8BUWa9POuhBW2Vv1f1Y=; b=isZewW95psykZnX9ClHQC/d92dZ2DzA2183Lv9Z+1Y9h4bNNnIvzjTN/ioc5SWLJWJ GiDdldIdmUQEYotMHLAE3D4DvbP/N/GmwZFPC99zdqMdWdLSbxO/a+/2tIN6Y03PMHhY Vt+LO2cm01a7KW581PcaYy0syeW9X4AzoyRS0VwDEzEjugjM1VSudikiwIeyssdhrmdk 2w4OYXAGQk2QcnreOkB693VjYTdEVG/jFDa9KSvmdgS67lMNC6EpJgfQl6Z3e4sbb2sW faEADMp9yuyB/ScBj4eUs9jUF5xEd+Yn5RTdevvTGLA00WCwefzvQLH9dzCzJ2p/Elj6 919Q== X-Gm-Message-State: APf1xPCJ2l0ltWfQlybqIFSBO10Owzoo+sz3mKgE61buosfIPZ/FBuPN 8jVfXpTROdLJGvvXhtPQe19+Ww== X-Received: by 10.80.220.141 with SMTP id r13mr5059023edk.120.1517945001089; Tue, 06 Feb 2018 11:23:21 -0800 (PST) Received: from localhost.localdomain ([2a01:e0a:f:6020:29bb:43dd:7d11:e095]) by smtp.gmail.com with ESMTPSA id s5sm78155eda.60.2018.02.06.11.23.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 06 Feb 2018 11:23:20 -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 v2 2/3] sched: reduce the periodic update duration Date: Tue, 6 Feb 2018 20:23:06 +0100 Message-Id: <1517944987-343-3-git-send-email-vincent.guittot@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1517944987-343-1-git-send-email-vincent.guittot@linaro.org> References: <1517944987-343-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 b9660b5..e203297 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);