Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp905812rwd; Wed, 7 Jun 2023 08:22:27 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6sjXXQebxV3oDJ93sNNqeYpaSwcNTl1RheEjTSHbOjIpMXBg+hpajrzxRRJW/700F2sZI2 X-Received: by 2002:a17:902:da89:b0:1b0:3742:e718 with SMTP id j9-20020a170902da8900b001b03742e718mr2653741plx.25.1686151347326; Wed, 07 Jun 2023 08:22:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686151347; cv=none; d=google.com; s=arc-20160816; b=kM6bk6sUIIH/S+3IZ2qdOBj98vdnZF5ibiUyihpYyVoAQxISRvaZs6PoA52M7PpzfE 7H2+3U0LY3vPfAoTeyqTQauiMPxAo0jzGkifN9e1sLzRQmQbNSz0bWpt0hWMt+wIF4V5 s1hTNOyrl2pwb4pMC3YvQehKkYclGu726XJ3LHRFGyMPdwttV9xIgC8Tu4gsm53IQcvT 1p1hjOqnvdSg1owMGDT5JnhctqZ2TmK8KMU9amnYRorPYLzOAN9i7ZJVrNBVIxX19EWQ MfWfjW27agJfACA0iX04mloU3tEKFpWG+HXawTmPJ4besON4boTsgCQSvODollhJwuVF 1/7A== 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=lFFqMo62u0+pp6VNx3B0whVmekpYaM5r1qrUMkqU1YM=; b=LLvj5wQ5lrRPa9N2vaY6kUM5t8EU+eN7rss1vZN+JDYLtVF/OZ1/G/JvgK04t8ph1o OmEpQLNSEZQ043p83KHqL3Z5rStg2+AZZbgpTxgDXaIhkTjTasvi+P3dKNDm2A6lI/SH bbTQA5AhW54mxMV1RMVpuLaxIHCeWUtLOGXsUTRIAVUQXwEqBhjQw1FJIzh1ETmHYBFz y2RoJ0zoknyukfAI6VOW8d7E9LL06MxRHg5vQz4mGV/ruL7jCmztJfpAiuDQRVpBch7w 7SFYeMJp1NUPtZOlrp7DWuy3IV00G71qBUvl9t+6skYdJDolbmTCLDNpHGa47eBZr+3B E+tg== 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 o6-20020a170902d4c600b001a99941abbfsi9262568plg.338.2023.06.07.08.22.12; Wed, 07 Jun 2023 08:22:27 -0700 (PDT) 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 S240581AbjFGOwG (ORCPT + 99 others); Wed, 7 Jun 2023 10:52:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240162AbjFGOwF (ORCPT ); Wed, 7 Jun 2023 10:52:05 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 095EF1702 for ; Wed, 7 Jun 2023 07:52:04 -0700 (PDT) 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 355E5AB6; Wed, 7 Jun 2023 07:52:49 -0700 (PDT) Received: from [10.57.24.86] (unknown [10.57.24.86]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 48BD13F587; Wed, 7 Jun 2023 07:52:02 -0700 (PDT) Message-ID: Date: Wed, 7 Jun 2023 15:52:00 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.11.2 Subject: Re: [PATCH v2 1/3] sched/uclamp: Set max_spare_cap_cpu even if max_spare_cap is 0 Content-Language: en-US To: Qais Yousef , Dietmar Eggemann Cc: Vincent Guittot , Ingo Molnar , Peter Zijlstra , linux-kernel@vger.kernel.org, Lukasz Luba , Wei Wang , Xuewen Yan , Hank , Jonathan JMChen References: <20230205224318.2035646-1-qyousef@layalina.io> <20230205224318.2035646-2-qyousef@layalina.io> <9e935645-9baf-af9f-73bd-3eaeaec044a8@arm.com> <20230211175052.b7a4hddhkjk4j6qf@airbuntu> From: Hongyan Xia In-Reply-To: <20230211175052.b7a4hddhkjk4j6qf@airbuntu> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE 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 Hi Qais, On 2023-02-11 17:50, Qais Yousef wrote: > [...] >> >> So EAS keeps packing on the cheaper PD/clamped OPP. > > Which is the desired behavior for uclamp_max? > > The only issue I see is that we want to distribute within a pd. Which is > something I was going to work on and send after later - but can lump it in this > series if it helps. I more or less share the same concern with Dietmar, which is packing things on the same small CPU when everyone has spare cpu_cap of 0. I wonder if this could be useful: On the side of cfs_rq->avg.util_avg, we have a cfs_rq->avg.util_avg_uclamp_max. It is keeping track of util_avg, but each task on the rq is capped at its uclamp_max value, so even if there's two always-running tasks with uclamp_max values of 100 with no idle time, the cfs_rq only sees cpu_util() of 200 and still has remaining capacity of 1024 - 200, not 0. This also helps balancing the load when rqs have no idle time. Even if two CPUs both have no idle time, but one is running a single task clamped at 100, the other running 2 such tasks, the first sees a remaining capacity of 1024 - 100, while the 2nd is 1024 - 200, so we still prefer the first one. And I wonder if this could also help calculating energy when there's no idle time under uclamp_max. Instead of seeing a util_avg at 1024, we actually see a lower value. This is also what cpu_util_next() does in Android's sum aggregation, but I'm thinking of maintaining it right beside util_avg so that we don't have to sum up everything every time. Hongyan