Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp377907rwb; Wed, 9 Nov 2022 03:51:43 -0800 (PST) X-Google-Smtp-Source: AMsMyM7bmcHFddTXzyvzPROFe1+3SPCoMBnLzn5+TMtTG9jxGesjoiqGu8A8+B2Hl5ECbGnLhk4d X-Received: by 2002:a17:90b:2504:b0:212:def1:623b with SMTP id ns4-20020a17090b250400b00212def1623bmr63340510pjb.47.1667994702948; Wed, 09 Nov 2022 03:51:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667994702; cv=none; d=google.com; s=arc-20160816; b=rHCTxXWOXjxqUlmZcrWZtCLhRCaIoT9qk7C/vGoyk4R47jhvm8h1YfBfzed0CUHBm2 u/FqFisuao2CxaaeSeG2m1eG4mjkU3vDvowimA1nh2nxoljO4dkuTIsa/dJ592lZ7SOr 9/2xdT85WuzKxoQAWnhcIWLHK3AnhJMs/dbktRwhCDM982sGExjwj/PPplzgngnLqhQd uPHP1t2PDXhbzhae83SUdzUse70/wLpwBwqz38LmnH1z502MgM6yhnZZu0e5Mmz0CMac jE3M9X9BWG0+vFO0MAMTAMrtMCkUx/oQqkewI1iLheCMMyl3RBNDC9uaH/OTSrPA+aMQ LQEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=5PGF0bXD+HeZfDI0mJazCO5lC4lzXkBRyitgGyu60T0=; b=ROwL2Eplkj9HGwsIPmau5PnPic7LTkOq0lq7ToYNMSVWnn1l5DGddp8eM8zap4xW1Y uMB/+oLSz3+Ini7Xa3cchoRU9V2PhkXGlio9ILlbKrnf1eFTyTPDSHpS5nPI4FdZtF7G A3AvmQj2vp6ZFPrI293JFQTV6j54lOaiZe4kmSYbBpZWPBaOLtVtfUXVSJFE/KvMLduU FdLoCmOVTbO4zAuRkGeqBCkxWn168jtPey7nBxa2xTl1TCw2GRKearBLuEu26gIB7eyw YyP1esfMo5zFfs2hK2Jle+isCVPYksuW/aX/1I64CH+lMbgYxcI07u6JVsJUOoacdwlf xX9A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z11-20020a1709028f8b00b0017e0ca906c8si15526745plo.568.2022.11.09.03.51.24; Wed, 09 Nov 2022 03:51:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231175AbiKIKob (ORCPT + 93 others); Wed, 9 Nov 2022 05:44:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56836 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231229AbiKIKoR (ORCPT ); Wed, 9 Nov 2022 05:44:17 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 2BC99AE72 for ; Wed, 9 Nov 2022 02:44:16 -0800 (PST) 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 0AAE01FB; Wed, 9 Nov 2022 02:44:22 -0800 (PST) Received: from [192.168.178.6] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 297063F534; Wed, 9 Nov 2022 02:44:14 -0800 (PST) Message-ID: <107bf66d-8924-c287-125f-10a648c7b701@arm.com> Date: Wed, 9 Nov 2022 11:43:58 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH v2 9/9] sched/fair: Consider capacity inversion in util_fits_cpu() Content-Language: en-US To: Qais Yousef , Valentin Schneider Cc: Ingo Molnar , "Peter Zijlstra (Intel)" , Vincent Guittot , linux-kernel@vger.kernel.org, Xuewen Yan , Lukasz Luba , Wei Wang , Jonathan JMChen , Hank References: <20220804143609.515789-1-qais.yousef@arm.com> <20220804143609.515789-10-qais.yousef@arm.com> <20221105204141.3tno6fzuh536ye4e@airbuntu> From: Dietmar Eggemann In-Reply-To: <20221105204141.3tno6fzuh536ye4e@airbuntu> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org - Qais Yousef On 05/11/2022 21:41, Qais Yousef wrote: > On 11/04/22 17:35, Valentin Schneider wrote: >> On 04/08/22 15:36, Qais Yousef wrote: [...] >> IIUC the rq->cpu_capacity_inverted computation in update_cpu_capacity() can be >> summarised as: >> >> - If there is a PD with equal cap_orig, but higher effective (orig - thermal) >> capacity >> OR >> there is a PD with pd_cap_orig > cpu_effective_cap: >> rq->cpu_capacity_inverted = capacity_orig - thermal_load_avg(rq) >> >> - Else: >> rq->cpu_capacity_inverted = 0 >> >> Then, the code above uses either rq->cpu_capacity_inverted if it is >> non-zero, otherwise: >> >> capacity_orig - arch_scale_thermal_pressure(cpu); >> >> Why use average thermal pressure in one case, and use instantaneous >> thermal pressure in the other? > > There was a big debate on [1] about using avg vs instantaneous. > > I used avg for detecting inversion to be consistent with using average in in > scale_rt_capacity(). I didn't want the inversion state to be flipping too > quickly too. > > I used the instantaneous in the other check based on that discussion. It seemed > using the average is hurtful when for example the medium drops an OPP and by > not reacting quickly at wake up we lose the chance to place it on a big; which > if my memory didn't fail me is what Xuewen was seeing. > > [1] https://lore.kernel.org/lkml/24631a27-42d9-229f-d9b0-040ac993b749@arm.com/ > >> >> Can't we get rid of rq->cpu_capacity_inverted and replace this whole thing >> with an unconditional >> >> capacity_orig_thermal = capacity_orig_of(cpu) - thermal_load_avg(cpu_rq(cpu)); >> >> ? > > I can't see how we end up with equivalent behavior then. Or address the > concerns raised by Xuewen and Lukasz on the RT thread in regards to avg vs > instantaneous. > > Specifically, if we don't use the new rq->cpu_capacity_inverted we can't handle > the case where the task is requesting to run at maximum performance but a small > drop in thermal pressure means it won't fit anywhere. That PD is the best fit > until it hits an inversion. > > Originally I wanted to defer handling thermal pressure into a different series. > But Vincent thought it's better to handle it now. We want more data points from > more systems tbh. But I think what we have now is still a good improvement over > what we had before. I can't see the rationale in using: !inversion: `cap_orig - instantaneous thermal pressure` inversion: `cap_orig - PELT thermal pressure` I can see that there was a lot of discussion on this topic but hardly any agreement IMHO. AFAICS, the 2 capacity inversion patches just appeared in v2 and haven't seen any review yet I'm afraid. [...]