Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp325878pxj; Fri, 7 May 2021 09:26:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwNkDKBtXOD6jyPmxT6imZprJR21dKJnACTfCf6K4oPTJ+O7qB8T9efratLJ5vAemWKOxbA X-Received: by 2002:a17:90a:246:: with SMTP id t6mr11577655pje.228.1620404787263; Fri, 07 May 2021 09:26:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620404787; cv=none; d=google.com; s=arc-20160816; b=kYHn1Fxqplyfqm+m0BUUwUy52GMKhYh+IE9WYibNqDcjFYLe+ucxOVNiifkRTPTTb4 egPn+lXpugrDXyqRC8j+qv50BUMZ98y6HHJ629EL50qs+2T1RBwRPiXDOUnFVpn/5YTt AMFdYBftqBl+MYj60gbxkWWQOKRUa57G5F8DxODX2/QbFZl3eAjKGyA/c3hcwwx03olb 16DBYfyh4iuOS7Lzv59SMxKUy+tlsglnTEEWMeEeF4OMujlnxU2Q5jUXaT6OZ8/m7fSD Ii6H6sUmEo7VfuH1WM6NPVvteZiWU5SZCn8oU4IxuymXdb7wwZhT1HSu+MXKXK9wiorj nrAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=QKCpjS6b01+17sdb02JeSbOtqIUua6qP6QMTMx1HmX0=; b=MIwLtO99CZHyDmf24Y8ZIU+zxGtzODzB5iOrwBZYUK0ZTC1w5OOI1U7HsEpYria0pb N+Xi/uw8AKg7aeJUJGoL58p52hTuWvNBGpq2p2047ITw7q15J5PGjhAutmkJjX9Oj5s7 5ABArzy8p58QbmZP1bpCVBC6PdN12hPdgX3Np/GR9py1ssL61swG5INJFXhSvM/YGhxo uds4I+vMFNjWa4LEYmTmFrLq9Tck0oIdUSXuUvkjQ5lNcGnEWcnNMgBvakqCmF+NmNxP JLLJHI7h31V8l8iLKRAZ2zrxux7B6qT5l1IROHdUWYDukPFKJG67n/k39bvcXDnqQ42V qknA== 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 c5si7364287plc.286.2021.05.07.09.26.12; Fri, 07 May 2021 09:26:27 -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 S229621AbhEGMgf (ORCPT + 99 others); Fri, 7 May 2021 08:36:35 -0400 Received: from foss.arm.com ([217.140.110.172]:57920 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231179AbhEGMgf (ORCPT ); Fri, 7 May 2021 08:36:35 -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 43BF4106F; Fri, 7 May 2021 05:35:35 -0700 (PDT) Received: from e120877-lin.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 66FCF3F718; Fri, 7 May 2021 05:35:33 -0700 (PDT) Date: Fri, 7 May 2021 13:35:28 +0100 From: Vincent Donnefort To: Xuewen Yan Cc: mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, 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: Re: [PATCH v2] sched/pelt: Keep UTIL_AVG_UNCHANGED flag in sync when calculating last_enqueued_diff Message-ID: <20210507123528.GA106818@e120877-lin.cambridge.arm.com> References: <20210507112031.23073-1-xuewen.yan94@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210507112031.23073-1-xuewen.yan94@gmail.com> User-Agent: Mutt/1.5.24 (2015-08-30) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 07, 2021 at 07:20:31PM +0800, Xuewen Yan wrote: > 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. Unless I miss something it actually depends on the situation, doesn't it? if ue.enqueued > task_util(), we remove 1 from the diff => UTIL_EST_MARGIN + 1 if ue.enqueued < task_util(), we add 1 to the diff => UTIL_EST_MARGIN -1 > > 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 >