Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp1325007pxy; Thu, 6 May 2021 05:49:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwg2c8h9i0+IhjiMzd+Lm5ZHH8iJQw0gN0ZBAmU8f8NCJAjUUsDuQUNzn8SEG5dslRbJh39 X-Received: by 2002:a65:4286:: with SMTP id j6mr4164396pgp.261.1620305396325; Thu, 06 May 2021 05:49:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620305396; cv=none; d=google.com; s=arc-20160816; b=SRzqIQKktsVNQ7shW2lnZ8WzYFS5lNz11lEaUAv9dlq9sLD1NCgg90Ty/fKOMGY1Qq F9zFSfstGhwvOVbmdaNpPUvvjaA3AtmXSWgLxd/fWbuYiPuZyiEQNQRmK7KZ2b3OJbAr XNr6Eif09JOUKKf01RwjVOGjcE3P0ky5PJkw3OI8mLcD7XNGsAGWMrTP1dtXzZj84TaC b3YXEMNbBKBSIRXBdXSAlQ6LConXljz/mA88M/UgaxlMjEgQVIgEQ/gmQ6B3veMSzSAl JvJdKtGBMe46/hzpLqFvLA6yRTqAI+ZoDJF868NRLBfnykwvKF+5bWG4zZQDp59B8AjR JSrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=tIRE8QgoHIdYOF8GPHvxQ+HvdFDXSfw9r/pCQC6+ol0=; b=sHRTNxQcRTsARN4XjucDdzayrNtv2171bc8cOYpKLUy/mkc8CH6/WJ48pqLwR/OE1A +6VBSTvmpj3tlxHJNfXAVm04DZHzDHte8n/89RO18RPtVEMyk2dCFPD2MzBHy+vCvTfw tbj1opLZe8IXTsboa7PqiHMnTnFcuuriDDzzQGpNPpZKppmXTF0tBmL8FPcyRPG5vhIK pnhiuQy4ECPUVftmLtkFAfOtuz6Z/4z/NXLwIIDVzWvdMyPfh+1b90tpgFPf9yHRHQt0 Lkb43/SJ2Q/8ZwvW37UDIkhcDhnrQtzNLaDtpVRA/4AQ83ymm1rzv77fBhSi29NjuM1N EasA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=DSf1wjC3; 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 q14si3511402plb.47.2021.05.06.05.49.42; Thu, 06 May 2021 05:49:56 -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=DSf1wjC3; 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 S230187AbhEFMsn (ORCPT + 99 others); Thu, 6 May 2021 08:48:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229769AbhEFMsn (ORCPT ); Thu, 6 May 2021 08:48:43 -0400 Received: from mail-lj1-x232.google.com (mail-lj1-x232.google.com [IPv6:2a00:1450:4864:20::232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB198C061574 for ; Thu, 6 May 2021 05:47:44 -0700 (PDT) Received: by mail-lj1-x232.google.com with SMTP id a36so6861770ljq.8 for ; Thu, 06 May 2021 05:47:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=tIRE8QgoHIdYOF8GPHvxQ+HvdFDXSfw9r/pCQC6+ol0=; b=DSf1wjC3qLWw0y4zWaZrNJYe88iiGWkjjk3VJpK0Iay6DXEa5pw1qOFrmx1mU2GcL0 UsGPrxnLxynv039A8OneG3YWNrG7BWmasP2KgdZ5cSsjKjFjfIfsrf/rqEDHMQ33q7fv iwFvbWjsQ6v3DWRu3Nu6G+fFyOGhi8GvyZTjITF9kYeME79eRy3wFf41l05j5pv/AXlV 703jQsYtsL4I2bR67Kjz+zI8LBEbs66wxXYv91qShfAhJOBVChXTTfvvhVkSjgi0nuHu XSP0rQZAUwIN78lAUAWV8/Zc3Jrf+Ir9QJW/HtzCjrDiCZvE16jWVC6jV55/tQP2m6l2 Q9Qw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=tIRE8QgoHIdYOF8GPHvxQ+HvdFDXSfw9r/pCQC6+ol0=; b=JvQtGP8cF3bEJMq9Vxt9LT18c2mGanXO3Lj42sm56eCErm0rb3FRgk4j65twTF55Jg fiUUxKnOeoTCI4kIBwX7huuXIE2yvmHtZon0IzWoJl9wYXuJGDPSspR53e6QseNDz4sd hXYZmNeSZV6sL1WmpkJuBdYM4VpJFiB6YVsCxrqmedKsa0niS+eudaBx5BzmGqVO6rya WTfvPUcGRBWfDOCcOiRyQBOIuLQbmrmPlFYM0e2x0ElItfKp0af37Uvf1IUOfynHbEuu 0Sl2MH6+bzRQJGvc0U/3YxPtN2qqBD2jUA/vWPFszpS/vx+70xJ1m6lfb6LJ2mSLPZWy KLEQ== X-Gm-Message-State: AOAM530waLfHkzFhr7aICK0o8Ubja/inHg3maR3FrQPsruXlOESkw5qt B2SnB0N/tXpoZAIIzOI+iKj5otrSe5UPCByuFDg= X-Received: by 2002:a2e:7306:: with SMTP id o6mr3173444ljc.420.1620305263193; Thu, 06 May 2021 05:47:43 -0700 (PDT) MIME-Version: 1.0 References: <20210506110936.8797-1-xuewen.yan94@gmail.com> <20210506122823.GA8671@ubiquitous> In-Reply-To: <20210506122823.GA8671@ubiquitous> From: Xuewen Yan Date: Thu, 6 May 2021 20:46:08 +0800 Message-ID: Subject: Re: [PATCH] sched/pelt: Add UTIL_AVG_UNCHANGED flag for last_enqueued_diff To: Vincent Donnefort 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 Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. > > > > 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. > 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 >