Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp261898pxj; Fri, 7 May 2021 08:08:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwxsfNOVvaGPmAq1nBMi/vhZkpbscdczwDG65qdtUBVVAantdyc4SvtK6dm9wKeVBYH+bko X-Received: by 2002:a17:90a:4216:: with SMTP id o22mr5528636pjg.3.1620400090990; Fri, 07 May 2021 08:08:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620400090; cv=none; d=google.com; s=arc-20160816; b=GHGu2fzkZEwWEpDfr/JmLmqzK4K5ttBBXd8sWQXyjfMEZeZHY6AndPuM4EbC2JYocr gmLHwClDeXHJAfTSQB+F6E1z9qdg7xTJEyn1HU3fSk49bqwpWghCa6JhKuq2j5RqBCqV HEg775rvEhXdXDy9i5brmUwYb4mVnW63ItFC2c92dNqbxDb71O1y3Aoy0inYfAG3LUpP XeslOIDBz2fPFLDLGCG0CJHMgDZh6M8mTkiop2LYgBPNNzr/VUxfR6uFIRVyle9kwGo7 zykkOHKbL+Fv6/5MhwZKfK2/chPXB4THCmojRDmiijAq4907htgOjJSILE6EtyLHAstv 9Iqg== 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:dkim-signature; bh=uK5+osygTfkJECGuaQ+nf52n4LESXipwFidcOnVuOn4=; b=dPKCCYAcVIy1oPy82wc+SmUHwu9vNYIAmnSMTui5/XFEEgTJOm7lEIDhggN58dfr0F ounxrcHr8frizFutMQpY0T35+2w4iJH/3eWGZ/Sgz/+XSYyBnJDu6gaqKPpz79Ya3hmO Q3gjYf+czldb9JYX+nB7SArPf2wppowgO9+yOe//mQ2Tu8y+rbTUfex64laIQzGuWkxi I1LtFK/vWQZWNWhEm22rpSQoUMY/0FgJSsi+JEnePnn0cbZ1R7sR7jIVLgrKfIBpeU+p V+Bxz1qwx1diElYd5aDBVFWyaXXoJ3Is389hQjOfH69qxcU2UPNQHJbE5tcWYCAx0MK8 DGKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=AlxWGWw5; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e1si6933735pgs.322.2021.05.07.08.07.58; Fri, 07 May 2021 08:08:10 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=AlxWGWw5; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235127AbhEGLXf (ORCPT + 99 others); Fri, 7 May 2021 07:23:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43358 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231932AbhEGLXe (ORCPT ); Fri, 7 May 2021 07:23:34 -0400 Received: from mail-pf1-x433.google.com (mail-pf1-x433.google.com [IPv6:2607:f8b0:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E25AC061574 for ; Fri, 7 May 2021 04:22:34 -0700 (PDT) Received: by mail-pf1-x433.google.com with SMTP id p4so7428949pfo.3 for ; Fri, 07 May 2021 04:22:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=uK5+osygTfkJECGuaQ+nf52n4LESXipwFidcOnVuOn4=; b=AlxWGWw5gQDh5aTMudgFgWrKU2Vs4fxblXRW1OLs2CrR0BmTI/19GqMeMczJH2UGU9 e7Df96ZYdCQ3zU+xXdumrkxhhzmEtrO4W9iZJJR5dEPMRuaTphe86Ci/WZUjz3Daw5Uq QmmFy/lkhp8HzgGFbane5k89NVNG3hJcQRjRzpvVCsT6D0orASgeMz/a5juAgbvom4Hb Kh3EegoMoQ2BcUfMBsUKvBz2HcAZXNId4+hDt+mZL62cz/nMc5I8e2U0wD9YYPpZIeSz r8RBw6mPBuPcpAkaYEKABFSw04bXE062AKNYLt2jwNejLuCK2jDJP+mg9mcg1BpOFBxD YFvQ== 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:mime-version :content-transfer-encoding; bh=uK5+osygTfkJECGuaQ+nf52n4LESXipwFidcOnVuOn4=; b=PNNeHR7V0WTtVdH0mIIVmq1eJmLw8aaQDdDAzPCeI2hzi8FDstkKK3Xkg+olN3GEsQ iMpnGZY96aLaomyNLrvv9Pd3HfYzv2ZPTFC4Ke/FnadHNz9QGznaHABp0/yMNbx95ejw 8aEqgRhJOZu8IS2NaKlsrpu1jff7YEmFNNc73dx+uGx/Ukn+qQYcipeNm2mRkMZtz9EL GC8hl6Uh6o5E51hgXHF0rW8E4OrZ9kps6VaQc+o5a6osYuKMDdKIolE7GwW0u+tCszFx qe1uOHPgsHKj0gE/pM6HrQQLUCXL9dheGfoHIhS4GB7xKqxx5ANf1ag0K9HiMRMWHUQc rCJw== X-Gm-Message-State: AOAM531091M8eofJUmgdFbRmi2o/rh0xbn39X60dMG/vMjsrNK/YPvta d3jG/QEV/abaL8DVGnsVf9I= X-Received: by 2002:a05:6a00:c3:b029:28e:d284:c39f with SMTP id e3-20020a056a0000c3b029028ed284c39fmr9859820pfj.4.1620386553798; Fri, 07 May 2021 04:22:33 -0700 (PDT) Received: from bj10918pcu.spreadtrum.com ([117.18.48.102]) by smtp.gmail.com with ESMTPSA id t19sm4372633pgv.75.2021.05.07.04.22.30 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 07 May 2021 04:22:33 -0700 (PDT) From: Xuewen Yan To: vincent.donnefort@arm.com, mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com Cc: rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, bristot@redhat.com, linux-kernel@vger.kernel.org, zhang.lyra@gmail.com, xuewyan@foxmail.com Subject: [PATCH v2] sched/pelt: Keep UTIL_AVG_UNCHANGED flag in sync when calculating last_enqueued_diff Date: Fri, 7 May 2021 19:20:31 +0800 Message-Id: <20210507112031.23073-1-xuewen.yan94@gmail.com> X-Mailer: git-send-email 2.29.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xuewen Yan Last_enqueued_diff's meaning: "diff = util_est.enqueued(p) - task_util(p)". When calculating last_enqueued_diff, we add UTIL_AVG_UNCHANGED flag, which is the LSB, for task_util, but don't add the flag for util_est.enqueued. However the enqueued's flag had been cleared when the task util changed. As a result, we add +1 to the diff, this is therefore reducing slightly UTIL_EST_MARGIN. Add the flag for util_est.enqueued to have a accurate computation. Fixes: b89997aa88f0b sched/pelt: Fix task util_est update filtering Signed-off-by: Xuewen Yan --- kernel/sched/fair.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index e5e457fa9dc8..94d77b4fa601 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -3996,7 +3996,7 @@ static inline void util_est_update(struct cfs_rq *cfs_rq, if (ue.enqueued & UTIL_AVG_UNCHANGED) return; - last_enqueued_diff = ue.enqueued; + last_enqueued_diff = (ue.enqueued | UTIL_AVG_UNCHANGED); /* * Reset EWMA on utilization increases, the moving average is used only -- 2.29.0