From patchwork Tue Feb 13 10:31:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Guittot X-Patchwork-Id: 128211 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp4106828ljc; Tue, 13 Feb 2018 02:31:42 -0800 (PST) X-Google-Smtp-Source: AH8x224q3BsaFqp3fVper7XhUe9/GYsxApi07nv6fIM6hf4q27LWPqhJ02ZZJUgcTwjhc1ue6O9Y X-Received: by 10.99.110.10 with SMTP id j10mr628967pgc.72.1518517902172; Tue, 13 Feb 2018 02:31:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518517902; cv=none; d=google.com; s=arc-20160816; b=OLqa1Xsi0wR0meh4M3N81rmOMgn6uwUxKlpO2pcP9ZkaP5awIAuqgEGNZxYX6lP0Ow pj14KTxeF7xS2JyAjdTHsar0UaHe4OYzPCxH7dO6Eb139pIKe2eVMea2KncCTiYxJFvw aZfPsP45ls9B9jH/lWLdkkVlAJJH5yrs8xqWt4zWVmyfHfxM8S8NDWsdDLmk13g+v9rT gmLY1c5NG01bdbAr7IvRdKNZUDWdLRWGrFWHhYXO2w2cRHcXTDUhHBOnMCdLptAFgPYO w/8lKVUkVYtzYr359cuabrtawHtWrKxf4t4oDq+h/FXri0YGTOkzVvpoDYAduTfj1E7X HGsA== 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=0awVy9Eht9OU1vgZB1RJ/d7ScAU0JQVdWyx7O31zaGc=; b=xGYLguicbhmDU4RMqOsrDmiPU4sE0f3a4nZogsrs/bhjZWAJ4jmp3SBkTTO/GeERbd eXJPr7BrRnYX7GZCFGAw6hCivoeA7EwDtpSORIASRdXW+L0SjAP0E/S3uaPsilX+64NG xfC5mYEYn8FyAV6a83ByX/0nMBvJSsCagm7m7hiSrBgzTtpiMDtP3/3pHWgyxjbV1tzR nzD7F38uuyl7w8HptZFsPRN1/jczPdte4scpjdgcHuGF7pq5kWCu+eQBEAZkaeJUj8Ea 0J8/akD6GBKHsBg+lwVX4QtYyLqcA4t8QQW/29taCYiihlnc9vaRLrsnbYSOxZcNvHfQ 6SfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IIcsNfXV; 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 s1si1018112pfk.26.2018.02.13.02.31.41; Tue, 13 Feb 2018 02:31:42 -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=IIcsNfXV; 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 S934376AbeBMKbi (ORCPT + 27 others); Tue, 13 Feb 2018 05:31:38 -0500 Received: from mail-wm0-f67.google.com ([74.125.82.67]:39950 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934026AbeBMKb2 (ORCPT ); Tue, 13 Feb 2018 05:31:28 -0500 Received: by mail-wm0-f67.google.com with SMTP id v123so15114645wmd.5 for ; Tue, 13 Feb 2018 02:31:28 -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=0awVy9Eht9OU1vgZB1RJ/d7ScAU0JQVdWyx7O31zaGc=; b=IIcsNfXVV8KC6PILVyeUZ17V+zIdTv8KMxkmfpFPr355dvAWJaTLu7vIDLCTtr7Qeh xr2+ou+Yl849kDOfjNoNO8lls2i9u1kUHn57k4JyD770K44yS10yiiF/7dFWmGXI3YMD 0Kd/CETZegGwC12T0605wtV9vL7aKn8gliBk8= 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=0awVy9Eht9OU1vgZB1RJ/d7ScAU0JQVdWyx7O31zaGc=; b=oRl2s4z/tPsiPtcGIpAoVASJZ6MMWp8OWhBxQYtDQo8b6Dt0EY+GiXMp92kzyl5WWT pV230R8OUiqWraCrNJ2w1ECK78tOLHm/h0jSWpbcYuT7mEF32pTU/K6WB1EFRRkOmBP3 NY+VttkAT0kuQesgBhcw1AauldCrc0Yr7Jh8FTL+zbRSGxf6srV6Dpdcy1ojV+An1tBe dwCF9+w2aEii4iZmW3lXvmv+6PpiSdG0qaBpEmGbYfztnOinJuPfjmR1uUYLcwcaTMTy DWAPPm8MiteaPfIRNbr2Ex0V66WS+eIyg6aMoCfY1ULeHWCRydslYcluMQnmXkJsCxnY lalw== X-Gm-Message-State: APf1xPBCnMd6Q57OGIOfZQDDIAVaShIo/VCoNh9/rWpvMcQYfkkoEGGR oOHYv2f2O6a8GUNSazOLRFR5wA== X-Received: by 10.80.140.99 with SMTP id p90mr1535404edp.280.1518517887798; Tue, 13 Feb 2018 02:31:27 -0800 (PST) Received: from localhost.localdomain ([2a01:e0a:f:6020:2529:df33:8519:ee8c]) by smtp.gmail.com with ESMTPSA id a38sm6616542edf.97.2018.02.13.02.31.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 13 Feb 2018 02:31:27 -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 v4 2/3] sched: reduce the periodic update duration Date: Tue, 13 Feb 2018 11:31:18 +0100 Message-Id: <1518517879-2280-3-git-send-email-vincent.guittot@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1518517879-2280-1-git-send-email-vincent.guittot@linaro.org> References: <1518517879-2280-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 5a6835e..9183fee 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);