Received: by 10.223.185.116 with SMTP id b49csp1119076wrg; Wed, 14 Feb 2018 11:57:49 -0800 (PST) X-Google-Smtp-Source: AH8x227IRpl6iUltcDIgNC+GWSVTlQNHrPpAPCsd2vuTCFBbgRpYZK/irnPJQWwlZXq01ctZrz1t X-Received: by 10.99.116.23 with SMTP id p23mr134643pgc.178.1518638269226; Wed, 14 Feb 2018 11:57:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518638269; cv=none; d=google.com; s=arc-20160816; b=GPs+B7PVZri8hyjsxDlHsdxgW+p8oS8kdD6fsXnjpNvvGUQYUK8YC0XOT61D9joKtj hTcJKyNdDmtwZQPWmx6xbmKQQ64ifZ8KGl22MkhqZfA8+ULBoAcv2B/tRk96ETPUBlhm F3p+4bPmL4kxX90Nai8dmMbgRFtqfSJBfoc9odnWUyj4AJj2nKfA+WkSPdInv4dIvqQ/ bZ7AHAmejkTQNrDKMZY28gHJVlVytWLxo2o4UaD6Gil/pC5uKebX0aDjcN1vQ4anjJZ5 mhUkZnbYA4/Yeul6GPFZInAV4FEzvbPrrV6COBxh1OEe5EpSLqxMmU8R1rlHcYtEyrbm 5h4w== 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=xtjxrpFEBnSOmgHQGExKPZhqEUm1+aiq9ZLWl1cEpT12Bw8V1Auf7jV/IivfztwVUc xxqIP4K89psgHEE7KwKvzuzM0ZmL3ILDoOUG9heNzjkyO9u+PufbfbamdXIRGqC2yEmb Z8wfM+JRe3EJ6522/zZXcjM2ujq4EvxvaBh0fWzmJUAZhfgMQsgaRJT3n3jZ0tIe3MhM PvULr6+DEcZSKAhYd/yUlGGLFwiZgCB1hMyd+eGHXBlZ/RT7wWqeyJOynn+bcgBPwrZG hCPibWEPMinpbkp/dU4fWO8G9qevL2xZP0ZI1WxEQlXQ1c4jFcXDdnE57bbZ3Gga3M+B kS1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WRwHiAxs; 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 n127si8347730pga.171.2018.02.14.11.57.34; Wed, 14 Feb 2018 11:57:49 -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=WRwHiAxs; 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 S1031338AbeBNP1C (ORCPT + 99 others); Wed, 14 Feb 2018 10:27:02 -0500 Received: from mail-wm0-f67.google.com ([74.125.82.67]:38832 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1031300AbeBNP0y (ORCPT ); Wed, 14 Feb 2018 10:26:54 -0500 Received: by mail-wm0-f67.google.com with SMTP id 141so22559095wme.3 for ; Wed, 14 Feb 2018 07:26:54 -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=WRwHiAxsHGpu8DujO7SGUQOaywRgT3NrYx9QeJL/KpvFSdYCyjx5ZYs32B4Ty8OwEU Rq8SzehNpCk2KSOymWKHLfZQiK/Rnpt//MoY/AC8xIRWRbOY/5gBse83VXzazIW7EbQc 9nlZ7DDpXV+YOe8lpKPuLEHaTIS2jqiFd1EYA= 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=q6QHCZJtw/6Ix5XzJLf2z2j/1PMJi+QzMflGDl53V+Oc6H3BRJXHp9/1RMUX/J/2AX hKh/3OoWqDloMKMCmhGSNLCR/ui5RkT1702CfK0glkLKoBgjB5SDGCdJdln88yB25Y/m 1tQTHi8PNt+IiA/Na6ZxslgVaJqGiQA+qE2izBTnhaN3iYbYrr7lD4j03+Bfs/1v9ctl Bj0YNiIVBWWnAvnPXMxrzQxSQeOS3giGnHAWMA6d6SmaPBhj8sbkPeCHoknuJvdOKoD7 QKfBDa3JHD4SV/Q0ADFjbTg6FLqHEFIdHev0/I3gKxT9VRktjRxP6TKY0gCKH8RAYaU1 pfOA== X-Gm-Message-State: APf1xPA4SaiAyNH8zNsmyxCRegRZCZfTOGaM6gGNGExYo/sF/3SlEP3a stR9wVTwqSGVwY/oJqNyMuCFyw== X-Received: by 10.80.175.162 with SMTP id h31mr7639312edd.48.1518622013522; Wed, 14 Feb 2018 07:26:53 -0800 (PST) Received: from localhost.localdomain ([2a01:e0a:f:6020:f0d0:a4bc:1106:ff2c]) by smtp.gmail.com with ESMTPSA id p93sm3361152edp.63.2018.02.14.07.26.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 14 Feb 2018 07:26:52 -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 v5 2/3] sched: reduce the periodic update duration Date: Wed, 14 Feb 2018 16:26:45 +0100 Message-Id: <1518622006-16089-3-git-send-email-vincent.guittot@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1518622006-16089-1-git-send-email-vincent.guittot@linaro.org> References: <1518622006-16089-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 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); -- 2.7.4