Received: by 10.223.176.5 with SMTP id f5csp1035142wra; Tue, 6 Feb 2018 11:25:19 -0800 (PST) X-Google-Smtp-Source: AH8x225QJ6wOhR0ALT/8bKlPkyl+it3OJl2BWiaTamofAt80DC8wuozx4Lp0jl0yfuvEqzUtInRk X-Received: by 2002:a17:902:aa46:: with SMTP id c6-v6mr3388331plr.357.1517945119652; Tue, 06 Feb 2018 11:25:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517945119; cv=none; d=google.com; s=arc-20160816; b=nnYorUrPhGnW6QhjcHWTj4hv5iFCA806FRr+ScCbisSXPRd0fNCDObrYyubhTxDfSa 2xW4pzKsX5WQocZ3gkDdClZx75jO/T4XWiL3Lurulb9oxzbQBtplIy5fZeYFbSbWkdDr vEJFOzCMJ5+/OIvALcp5nwvCJppvxbot0j3rWz7+SwKGIY5duN1Z5fA0mUyfCfSMkZpC RylHpPc9UtJghCIeGLkUanu/xrNDVVDCpgQ5TlspEUgzYjGRuaj1JqPcqpC/osyTa0OU mf5W+Vjh05oWeLrZPrj3SSjF6iU52qGAaJg+9CadWHteCtEQXbbk4XtbLXIH9+tm13vq JxqQ== 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 a5-v6si7013929plh.640.2018.02.06.11.25.05; Tue, 06 Feb 2018 11:25:19 -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 S1753021AbeBFTXY (ORCPT + 99 others); Tue, 6 Feb 2018 14:23:24 -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(-) 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); -- 2.7.4