From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DC56FC4707F for ; Thu, 27 May 2021 22:38:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A3713611BD for ; Thu, 27 May 2021 22:38:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235267AbhE0Wjv (ORCPT ); Thu, 27 May 2021 18:39:51 -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.