From patchwork Mon Feb 12 08:07:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Guittot X-Patchwork-Id: 127944 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp2977654ljc; Mon, 12 Feb 2018 00:08:16 -0800 (PST) X-Google-Smtp-Source: AH8x226zi1pRaa0d76LYdfeNMQm+Uo48WfVB+3F2+d7QL+y6FbKU7AHdMllWtNbcMd2yjSn6GUvC X-Received: by 10.98.141.208 with SMTP id p77mr10829663pfk.5.1518422896488; Mon, 12 Feb 2018 00:08:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518422896; cv=none; d=google.com; s=arc-20160816; b=HhzS+icFalAbi7JpynvtW1fCBNv1tvQI2XWAu84KQ0d30XUQ5Qqu+VY+xE5QSBIbIe s5u5nziy5Oau9GF+OFZlpzbOpz9kh0lDfv7iFJJlJQuAzptBR0Jej/tZ/Bd2xS0s3tOE jF4LH9gq76+hPVoCvWIvWmNIOTBmpPviSOYs6/tyR1CLpsyvwyxPk8Ao3p3iC54XfU44 H3/jipdXaTre/AGMFkPpP5jV2oyk5QXuMCEDxCnAUyIjoF/kBA/Nmhf/iV2iQhZbYF1F APkJLyj8VOWhWkV1XK5la3K+TEh/6hJIytMW+R185afxzuMbuo5JaDXHRvG5Umf8C0+0 zAvw== 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=DLzLoQQJyLnv/v+XGuR5Jz1BcVk7CD2lJ/418fj488c=; b=zja96diEqAzZrKpGmHYS3H6/OyDP62a7JVKixU4djOSfokYkY3gcnrTIUSeX7I98Qh uer3RigxoIA64ijEZ1zriWtQ8BUjVmRAnyWTKRm1+uzfFdtRrV783CN1IGkWfVsKx0Qh iiTALdU6YKwpLhqx0/5Wh1X8KCtnn6Jpmi8xkCXap6pQVH4o8TRdW29tJBiffeGgr8/4 uajLFW+gj2UK37GWT6XMgz8ZaS0/42WwKSCnyvjYQborCliZC2w4y7uagr9GhlqTDP9z PAIC4/5f2GxNbbO0+0FGEuH5yaCTKm8a4MZQoYjpPGs2euy0YbG+ISBlOUDjqf8PrvPN DBGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VDFouXQj; 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 b61-v6si5562713plc.265.2018.02.12.00.08.16; Mon, 12 Feb 2018 00:08:16 -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=VDFouXQj; 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 S932942AbeBLIIK (ORCPT + 12 others); Mon, 12 Feb 2018 03:08:10 -0500 Received: from mail-wm0-f68.google.com ([74.125.82.68]:51525 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932875AbeBLIIE (ORCPT ); Mon, 12 Feb 2018 03:08:04 -0500 Received: by mail-wm0-f68.google.com with SMTP id r71so7922233wmd.1 for ; Mon, 12 Feb 2018 00:08:03 -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=DLzLoQQJyLnv/v+XGuR5Jz1BcVk7CD2lJ/418fj488c=; b=VDFouXQjrhMUbvldJjR1c/12e9PJOZ88+sghDxmozBPCBDjWlNYcuxFPJXkzFAVOhq 1dFilkNRMuHR0zxGqnmOTpH86kXEceHyqq4i/upd6arhoh7l3s9wQMHLtf/t+j2qQGNO VKZW+c5vrJSDRRIIoZxDD6+tJt6FG6FMGHqCo= 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=DLzLoQQJyLnv/v+XGuR5Jz1BcVk7CD2lJ/418fj488c=; b=NGJi+mG57D36n7d6kICM8W7iAw/FXcwqPDUWj+aAGvEa+oF77YBFaLlv72aaFqKKrz vLdz98xq4XCOemSCNqKE7SUZiq16CCbYIztusXwcrc++3IRUcNOZpBOPUPAkCj4zLNvs CcS6xbY1ni2e7zt3OTTsO+Zu7iEo8bW/7jEVJREFQtTISbdaQLvorLOSkAn5OdEEQOEx xQsqOwZNRtZwtxafauWou3hrs9odcaTq9tZ36MxOMsVUsu4wifEgh8WffiI2BgQlbd1B UhaEnqL9zgZkYaHsesIfLnj7jxcoalT2k686dQ2/mxRHOmM1rRNpD9FTdAeHXYnB9ldg Li2A== X-Gm-Message-State: APf1xPAM86iOBNQXf16h1zcN2V4BTG0f/bKj3pQ5oFu+R4Q/bhx+SyVB Kvn3Z8nHZzp6HKhHeDEIj5ZHkfyh7bQ= X-Received: by 10.80.224.195 with SMTP id j3mr14748802edl.50.1518422882935; Mon, 12 Feb 2018 00:08:02 -0800 (PST) Received: from localhost.localdomain ([2a01:e0a:f:6020:8800:c3b2:94cc:861a]) by smtp.gmail.com with ESMTPSA id f29sm4853715eda.43.2018.02.12.00.08.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 12 Feb 2018 00:08:02 -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 v3 2/3] sched: reduce the periodic update duration Date: Mon, 12 Feb 2018 09:07:53 +0100 Message-Id: <1518422874-13216-3-git-send-email-vincent.guittot@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1518422874-13216-1-git-send-email-vincent.guittot@linaro.org> References: <1518422874-13216-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 e228d3d..7566424 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);