Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp1518464pxy; Thu, 6 May 2021 09:27:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz+4lntzC3iJdst7xejZUlol4mkbfxtq8HysBkcUIUre6J1LPCh+07IEtUEQ/BrvaVtJP/J X-Received: by 2002:a17:90a:c7c8:: with SMTP id gf8mr18412951pjb.113.1620318442815; Thu, 06 May 2021 09:27:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620318442; cv=none; d=google.com; s=arc-20160816; b=FNs/cyR5ckN04zZVQ5Htba/5o3PwIcWAZ2P87dfp236iitIV0Dw0AYTWqVVQx9//yH Cj+g05OjtWX92Cagyu8vmqax7aP/L6OIIN9mdGpOeMczHAqN4jw930CEfHhBHD+Q5xMQ Ol5c3caRgyYZOC7Li4ijheuY9fm4/DKQatZYiXcHsrEz5kp6TCdAU0bupA04Jtox6tVq 4KCBqbSOTPvqexTFA5B0WbzD1X5cykO6jSX1vzQDWWQHjcm2RcQUljkqK/T5rrImWirX GVXg+BULQRyXVySXNBn/gQGZml9mfESKyGTRNr4Ya5qfoY9ZEb1Bh49hzaU0wYkm6H/u ii2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=lvD7gy50BNudqsLAClWyH8KqbmU0O9YBp0+ZRKTJJrY=; b=XR5HynHzp9+UQQqscC3AoKpeNXNIx9okRPK37LAYWHVy59K0E++hlnnd9jatbrRhY9 oYWO39bMz8VaYA49tUey+lTL3y+Tw2PskbPcjHn4+RkDx/TDmbHaypxgY56R67bilGtV r4LK212vaYjvPBHQIOpCt6j8KDIco8/2+H6cUZe/btI3RWd20b9dn2D5RdExFHqJ3tSV /vBacLMqq6gz1DkwTuXiAxbGWhtZbteTLr1lP7QVvlkXhMcTngP6Pluxablxw77evokf eVpXhOxzyAmNTwfSoBBGvjkMvpvlDbScF24BTxdymeiLTK5LHzoGKQUi4r3IthmjSK+0 EzyA== 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 f2si3686252pjq.163.2021.05.06.09.27.05; Thu, 06 May 2021 09:27:22 -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 S235462AbhEFQ1L (ORCPT + 99 others); Thu, 6 May 2021 12:27:11 -0400 Received: from foss.arm.com ([217.140.110.172]:37406 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235167AbhEFQ1H (ORCPT ); Thu, 6 May 2021 12:27:07 -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 CCFA031B; Thu, 6 May 2021 09:26:07 -0700 (PDT) Received: from ubiquitous (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D34D83F718; Thu, 6 May 2021 09:26:05 -0700 (PDT) Date: Thu, 6 May 2021 16:26:00 +0000 From: Vincent Donnefort To: Xuewen Yan Cc: Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Benjamin Segall , Mel Gorman , Daniel Bristot de Oliveira , linux-kernel , Chunyan Zhang , Ryan Y Subject: Re: [PATCH] sched/pelt: Add UTIL_AVG_UNCHANGED flag for last_enqueued_diff Message-ID: <20210506162600.GA11916@ubiquitous> References: <20210506110936.8797-1-xuewen.yan94@gmail.com> <20210506122823.GA8671@ubiquitous> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 06, 2021 at 08:46:08PM +0800, Xuewen Yan wrote: > Hi > On Thu, May 6, 2021 at 8:28 PM Vincent Donnefort > wrote: > > > > On Thu, May 06, 2021 at 07:09:36PM +0800, Xuewen Yan wrote: > > > From: Xuewen Yan > > > > > > The UTIL_AVG_UNCHANGED flag had been cleared when the task util changed. > > > And the enqueued is equal to task_util with the flag, so it is better > > > to add the UTIL_AVG_UNCHANGED flag for last_enqueued_diff. Could we change the description here a bit? I don't think this is accurately explaning the issue. Would probably be interesting to mention that by not setting the flag, which is the LSB, we add +1 to the diff. This is therefore reducing slightly UTIL_EST_MARGIN. > > > > > > 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 > > > > > > > Hi, > > > > We do indeed for the diff use the flag for the value updated and no flag for the > > value before the update. However, last_enqueued_diff is only used for the margin > > check which is an heuristic and is not an accurate value (~1%) and as we know > The last_enqueued_diff is compared with the UTIL_EST_MARGIN which is > "1024/100 = 10", > and The LSB may cause ~10% error. I meant ~1% being the original margin. With the bit set, we would use 0.87% instead of 0.97%. > > we already loose the LSB in util_est, I'm not sure this is really necessary. > I'm also not very sure, maybe the calculation will be more rigorous > with the flag? > > > > -- > > Vincent > >