Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp22177905rwd; Fri, 30 Jun 2023 05:05:02 -0700 (PDT) X-Google-Smtp-Source: APBJJlESI1rdSIKYlBrUWTJPbixATIOnsOIPtlLFLXZp1mqS70sMDlzYKjSEJFGE5qs/jHbtOMmu X-Received: by 2002:a17:903:2601:b0:1b8:45e4:cc86 with SMTP id jd1-20020a170903260100b001b845e4cc86mr1259141plb.15.1688126701759; Fri, 30 Jun 2023 05:05:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688126701; cv=none; d=google.com; s=arc-20160816; b=D3rR98f7HaUPeIAbDlAIm7gYrnIMh7NMn24axy+ljrS9wk5Qf4TSfzO0cC31pOXDEB +zJ5E5TEEv3pI7OAtOHvNY3ax3uR88NmYyhE/vYNVqP/Aj1PlZWOorKf/o7IVVeohq25 OmWI01oyQRA7z7Q4Twy2iTi3VdC6AmNLP27M/GZslMOSG+bhFzVFla4dtZOVbgqQqqMy LHdYBN9p91yAxgOr+XnPhPcRo66141d0qfjXZdqvEZxnHAow/1BHnfrZ+a2rm+vicsiV ELPk2Ej4wdTR+Kxo7EbEGuFQ02iGPyLu1lIqIZU9y7QzQWAT5gsJ2fYOQsCNur2RnRwK BXfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Onl1jBKNUVAc7AFbiRXn2jzmir9C46s2tSDJirF66sQ=; fh=PGZjrhxJP77ROKmVBFQgu+QE0/WTi9YK3cKk0vVIdIw=; b=PDh4u5lKv1G4QGBhmU8nlvyQLzW4SpjYU/cG91gUP7VRRX7TXkl2u67gfM3UZK6PBF o2X3RIn7VUiQmlajk3+iBacSgPTQNK1PKIiDGzz9r51olDbJfSGIYrkk4v4PLSrNvba/ PlN2RkVcDs/bqees83No3rDv6uhsTZhE2Jf7xTP+Z+14AckrcInsie2OUZ4qDQWReQob FJl9lTqWDCGeyxjeMqmLUGZTzA6V+gbnzJHHCjA67AMP4ISrSffcm//BQaqvddZvGrRN patHNgUT7iHAs/i7EpOokfF761wCe52btgheiZKvifFW40cnY4vNzQn1cm210lOIQG3z hPrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@layalina-io.20221208.gappssmtp.com header.s=20221208 header.b=ioOWWAou; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c13-20020a170902d48d00b001ab0727a2c0si13067365plg.424.2023.06.30.05.04.47; Fri, 30 Jun 2023 05:05:01 -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; dkim=pass header.i=@layalina-io.20221208.gappssmtp.com header.s=20221208 header.b=ioOWWAou; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232825AbjF3Lvr (ORCPT + 99 others); Fri, 30 Jun 2023 07:51:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44338 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230506AbjF3Lvq (ORCPT ); Fri, 30 Jun 2023 07:51:46 -0400 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 532CA2D78 for ; Fri, 30 Jun 2023 04:41:47 -0700 (PDT) Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-3fb4146e8deso21993085e9.0 for ; Fri, 30 Jun 2023 04:41:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=layalina-io.20221208.gappssmtp.com; s=20221208; t=1688125306; x=1690717306; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=Onl1jBKNUVAc7AFbiRXn2jzmir9C46s2tSDJirF66sQ=; b=ioOWWAouAXpjOik/NTPusclNVYQLH4rFtxpswd4WXXT5p1C2scSSQgQdbs3m1yCc0y Xq9p2X+55Fnbf5La8fH29P/aGdlPJfXrWqe5GvQDGKA8HTQCn7KoZlZmNYYQHBb/Hsv6 3RR4r8xPAKF1lIugLTDPfILpOGtqo6DJQ7IGkrt9K+H+hhg9dL66y5wR+eax1SZf/E9z g5p4+WxLlpkBjyoIx5gas0YgXS9arpZqhyls0HESkxR9FR3qan9Yrp2jrcNsJnG8zj6e z9noqzN4yAcSdvm2szwzrueKjZ9wtrojYdhDbj+DMECZi2a0r8q50Yq+Dw/jY0E17SPM F2CQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688125306; x=1690717306; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Onl1jBKNUVAc7AFbiRXn2jzmir9C46s2tSDJirF66sQ=; b=GocG3A+w2Qlmc24IgpgLayoKNfSqlbTaXTpCVqGFArC9ghmF402s0kOz3r56Tw1Xgb SqMUWAo4YQ7q3IFntWtLw5cmRQ9DmUCAQqb4wPC40GqvTdo71bTn0oSEqlP7Bs6h/i1t QR6rXgAH7D2NM8vS4eHB0r+KA5sMZ4omzugw8+K4Qq5fDL/aZLSgnAS0BrFYxzFsfiot rmsx1JG0SRaiyNkmeGVlyWUsIt7IGs5sa5nv4P3rHP80cDZQeiQv4zyxAv7ZINlcmkfi 7grGP9avXwgS00PcVi+GOaSRXLnYOfcFzB2tKWxWkX85y3GmLgmvBJqai4AMdmZn0Eu1 +fBg== X-Gm-Message-State: ABy/qLbSw0cBtq1EKRLZjEldoUFJS4r6cQcSKe6zubc6UN2sm6KJ7/K1 obsbnRlvtsi3vpIZNxfnhWLXaQ== X-Received: by 2002:adf:fcc5:0:b0:313:e98b:7de2 with SMTP id f5-20020adffcc5000000b00313e98b7de2mr2549014wrs.0.1688125305796; Fri, 30 Jun 2023 04:41:45 -0700 (PDT) Received: from airbuntu (host86-163-217-97.range86-163.btcentralplus.com. [86.163.217.97]) by smtp.gmail.com with ESMTPSA id a7-20020adfe5c7000000b0030c6751a49dsm8666070wrn.115.2023.06.30.04.41.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Jun 2023 04:41:45 -0700 (PDT) Date: Fri, 30 Jun 2023 12:41:40 +0100 From: Qais Yousef To: Hongyan Xia Cc: Dietmar Eggemann , Vincent Guittot , Ingo Molnar , Peter Zijlstra , linux-kernel@vger.kernel.org, Lukasz Luba , Wei Wang , Xuewen Yan , Hank , Jonathan JMChen Subject: Re: [PATCH v2 1/3] sched/uclamp: Set max_spare_cap_cpu even if max_spare_cap is 0 Message-ID: <20230630114140.w3kiirw6lyjdvb6r@airbuntu> References: <20230205224318.2035646-1-qyousef@layalina.io> <20230205224318.2035646-2-qyousef@layalina.io> <9e935645-9baf-af9f-73bd-3eaeaec044a8@arm.com> <20230211175052.b7a4hddhkjk4j6qf@airbuntu> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,NO_DNS_FOR_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE,T_SPF_TEMPERROR autolearn=no 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 On 06/07/23 15:52, Hongyan Xia wrote: > 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. If I understood correctly you're suggesting do accounting of the sum of uclamp_max for all the enqueued tasks? I think we discussed this in the past. Can't remember the details now, but adding additional accounting seemed undeseriable. And I had issue with treating uclamp_max as a bandwidth hint rather than a performance requirements hint. Limiting a task to 200 means it can't run faster than this, but it doesn't mean it is not allowed to consume more bandwidth than 200. Nice value and cfs bandwidth controllers should be used for that. > 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. I haven't thought about how to improve the EM calculations to be honest, I see this as a secondary problem compared to the other issue we need to fix first. It seems load_avg can grow unboundedly, can you look at using this signal to distribute on a cluster and as a hint we might be better off spilling to other if they're already running at a perf level <= uclamp_max? Thanks -- Qais Yousef