Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3289058pxj; Tue, 1 Jun 2021 01:38:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzmHagLCnCNYcYtZs2Vqq9u552AE1kLQPIyaMFirpoMZiqMH+mWR+pOCY8tKZsajJbTT1nX X-Received: by 2002:a17:906:9706:: with SMTP id k6mr14904757ejx.456.1622536689171; Tue, 01 Jun 2021 01:38:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622536689; cv=none; d=google.com; s=arc-20160816; b=qugPMCUlhAX3JSMG5ejUUatUKRD+TJ7JCtX+uTZhcrS200Nzw1nBmoDDCS+8VcPTIa eI1P1vii/P0qmnCszK1rfYSYqyWD/UU3VMVDiF2A1evpjvqdFDAJ3qdSAyDCiFT/4sBV U1IcjS4LMVnvPqgM/uhYzYZMJakn1fiuhENkuFYUvafLtcvOhvfzxD7XDrwHrUJLBRHI OJcXt3posoR74ijTMXDRF+sloTmAMrOzturvnks78qIFIXEa7LrUeZ2T7FpHy/UY5QEa 2AID0/DRRW3ybWvpT9/kaU+G5jxh0fVowSe4cjmwm24ChZAuyOtPsDxQADOAsnxIJuNU 2FLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=krNM+OkU3iwA6snv3oD6IcBvMUe2UWwtqpa6grTVPUI=; b=ZO9BqoDlC1UoltJQsHbxqkR1ixPf1n+mJZUbZ1b/bOhxwl3/A5E7lJeCGUMF72vSGm CxoAarsK0C/SMs3VIf3rtOHx9HR5sRbqK1g6K6ojCr/UR6mIURtXQEcx9Gqb4+xNC5nN JJz00acZjNV6VrarwpVEm9JrQ+0hF1DyBkwVLChqqH7GD303hESDL1Qv3G5uI0qR4Aaq wLZUbUyQ3B+WZPHLykx1TDzwpfympPO5bNoi8D+nLaWwgmVdKHyvgk0WXKqKvUyPKk8L o8wV8yJRTZRYiJVzpALsyoruNb/dw180ODhE8YiG54wj7+NgwqnQFKF8vqR2nQQPsU2Z Acxw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id di7si10205675ejc.71.2021.06.01.01.37.46; Tue, 01 Jun 2021 01:38:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233299AbhFAIiP (ORCPT + 99 others); Tue, 1 Jun 2021 04:38:15 -0400 Received: from foss.arm.com ([217.140.110.172]:43318 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233127AbhFAIiN (ORCPT ); Tue, 1 Jun 2021 04:38:13 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 2930C1FB; Tue, 1 Jun 2021 01:36:32 -0700 (PDT) Received: from e125579.fritz.box (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 4C5193F73D; Tue, 1 Jun 2021 01:36:30 -0700 (PDT) From: Dietmar Eggemann To: Ingo Molnar , Peter Zijlstra , Vincent Guittot Cc: Juri Lelli , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , linux-kernel@vger.kernel.org Subject: [PATCH] sched/fair: Return early from update_tg_cfs_load() if delta == 0 Date: Tue, 1 Jun 2021 10:36:16 +0200 Message-Id: <20210601083616.804229-1-dietmar.eggemann@arm.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In case the _avg delta is 0 there is no need to update se's _avg (level n) nor cfs_rq's _avg (level n-1). These values stay the same. Since cfs_rq's _avg isn't changed, i.e. no load is propagated down, cfs_rq's _sum should stay the same as well. So bail out after se's _sum has been updated. Signed-off-by: Dietmar Eggemann --- This patch is against current tip/sched/urgent, commit f268c3737eca ("tick/nohz: Only check for RCU deferred wakeup on user/guest entry when needed"). It needs commit 7c7ad626d9a0 ("sched/fair: Keep load_avg and load_sum synced"). kernel/sched/fair.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index e7c8277e3d54..ce8e0e10e5d4 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -3548,9 +3548,12 @@ update_tg_cfs_load(struct cfs_rq *cfs_rq, struct sched_entity *se, struct cfs_rq load_sum = (s64)se_weight(se) * runnable_sum; load_avg = div_s64(load_sum, divider); + se->avg.load_sum = runnable_sum; + delta = load_avg - se->avg.load_avg; + if (!delta) + return; - se->avg.load_sum = runnable_sum; se->avg.load_avg = load_avg; add_positive(&cfs_rq->avg.load_avg, delta); -- 2.25.1