Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp994557pxj; Thu, 27 May 2021 17:17:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyaCBne83/PY85tyUycWA2aIXzhmGo/MibT7HMBVL4WfTC35zFS1FBCncVzKo4sFVkb20Hv X-Received: by 2002:a05:6402:35cc:: with SMTP id z12mr6957300edc.154.1622161065733; Thu, 27 May 2021 17:17:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622161065; cv=none; d=google.com; s=arc-20160816; b=gB3J+C/CkpdVYdPdaB6SG8duEfJ7cg8/BAtmsxd53nE1Em+ha0cLUm068TplWWRRQ3 tLxVHKhLPRV0zq81BjtkmytmQgdaftWfENnOjPxqGvMv7M1APHJ17hR2/2BXK0iHzS8K Cjw00bvLelk1IW75puhGHPoc9pAi+t8WIOqzGoEd7pJWrl4vrUVaOcdTLM9el4RWQivC ilABSFyfWJnYbEoYyDE1xPTB04luU4noQVbfJfNDVjfDG04AEcVCqN76sxcaZlM40PSi FQ+zIGybsO4FiB/9ollpq5EDHDv9oTz8c0J1hK3SxJtayL3K0En91l8IEQkQ5qXgw1tK zBLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=feiCBzHrtbdBDhHJ7+mtYnDG1R46CjhkgZeKTywVtKk=; b=PTWWcrTN28d/n2ZOy3TWanreDQevK3dWRP8yRJgQ69MaGuiFEhjjvLmYtK/+TfxEuq 5n92McotX9JujQQIZbF1IT1Q/Zk2BCfM1y84GP6yqu/nqt8VFGQ8fo7PssBjVCyU1rUH SpcXGYZloz6uDmSqXCTgZq0rCJmpX3+3LDGVQZPAavNkDtbYMD1O8qcYn3Dk+OjXPOn7 2QmjFKLoEdGMO5ONafntb88QAj7P/9TKCgZQmdoPv4cRQCdEjK4Qn9l8zEsHenn8urAz oMlLD2Khsclaksjd4KC4yG9II9mjOI6Hxrj2djKNwA3qRppLqJOY/qpkkIbpXGo9Sh// HcKw== 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 hp41si3611885ejc.369.2021.05.27.17.17.22; Thu, 27 May 2021 17:17:45 -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 S234783AbhE0Wjt (ORCPT + 99 others); Thu, 27 May 2021 18:39:49 -0400 Received: from foss.arm.com ([217.140.110.172]:34840 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233203AbhE0Wjs (ORCPT ); Thu, 27 May 2021 18:39:48 -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 47AD114FF; Thu, 27 May 2021 15:38:14 -0700 (PDT) Received: from [192.168.178.6] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B10EF3F719; Thu, 27 May 2021 15:38:12 -0700 (PDT) Subject: Re: [PATCH] sched/fair: Fix util_est UTIL_AVG_UNCHANGED handling To: Xuewen Yan Cc: Vincent Donnefort , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Steven Rostedt , Patrick Bellasi , Quentin Perret , linux-kernel References: <20210514103748.737809-1-dietmar.eggemann@arm.com> <20210519160633.GA230499@e120877-lin.cambridge.arm.com> From: Dietmar Eggemann Message-ID: Date: Fri, 28 May 2021 00:38:11 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 27/05/2021 07:41, Xuewen Yan wrote: > Hi > > On Wed, May 26, 2021 at 10:59 PM Dietmar Eggemann > wrote: >> >> On 19/05/2021 18:06, Vincent Donnefort wrote: >>> On Fri, May 14, 2021 at 12:37:48PM +0200, Dietmar Eggemann wrote: [...] >> diff --git a/include/linux/sched.h b/include/linux/sched.h >> index c7e7d50e2fdc..0a0bca694536 100644 >> --- a/include/linux/sched.h >> +++ b/include/linux/sched.h >> @@ -357,6 +357,16 @@ struct util_est { >> #define UTIL_EST_WEIGHT_SHIFT 2 >> } __attribute__((__aligned__(sizeof(u64)))); >> >> +/* >> + * This flag is used to synchronize util_est with util_avg updates. >> + * When a task is dequeued, its util_est should not be updated if its util_avg >> + * has not been updated in the meantime. >> + * This information is mapped into the MSB bit of util_est.enqueued at dequeue >> + * time. Since max value of util_est.enqueued for a task is 1024 (PELT util_avg >> + * for a task) it is safe to use MSB. >> + */ >> +#define UTIL_AVG_UNCHANGED 0x80000000 >> + > > IMHO, Maybe it would be better to put it in the util_est structure > just like UTIL_EST_WEIGHT_SHIFT? Yeah, can do. I just realized that 'kernel/sched/pelt.h' does not include directly (or indirectly via "sched.h". But I can easily move cfs_se_util_change() (which uses UTIL_AVG_UNCHANGED) from pelt.h to pelt.c, its only consumer anyway.