Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp7253167rwb; Tue, 6 Dec 2022 03:24:40 -0800 (PST) X-Google-Smtp-Source: AA0mqf6ePmvc4ZTWPgbfYC88SKdOsuOxfITNkQmQ4DuGGIaNwlLXh1PmFCpkQk6vLwjVxoQeOl6G X-Received: by 2002:aa7:cc8a:0:b0:464:1296:d5d4 with SMTP id p10-20020aa7cc8a000000b004641296d5d4mr74788268edt.83.1670325879828; Tue, 06 Dec 2022 03:24:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670325879; cv=none; d=google.com; s=arc-20160816; b=NER2ScbAp0j/0gi3WvXPmys/mkYLd2pQlmVsRAk82vkya0P8IqlAVh54TmAXY0NgJI pZDhtW5Kjm5pqt9sqd0o15P81RCUNjP9Alu2hBgKb5u70WHXwSsmum+EcLIzvHHXhoqZ QI32jTqNqG+E/JIj3Qi+nOzeGSceRBRij04sQHVsua0xTXcWFA0HQMS1e4CUu7QwysDI j88/GU0+z4D4HHhy5oS+aDZWpLG5oa3SlHrZuGT+8+nJJk5HTbj9myt6s9pd/+jd/wz+ iFqrgy7agqfhizCiP7u7R4nls3Z8GvAY7ZB544KgyUj8godC5bVyO7jEdbPzOqd+Ls7w 6x+Q== 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=cNzAg7fBoaboCL0GXxtr+qn6uSpkuLIzQswhCHZgWt0=; b=csLMD7E11DwsCSx/6y5QDBpXLxQdYvZuiGGwg7AkpsneLKdBvT2XlEF6zZpgW8Gsd0 BDkXkhY4NramtYUNJ3HbVgmPComvssrTWjQ5q0ssDioHbF2gXudmJ9s4kdPKMD39nHTu jO93keuLScKXTip3s6+1KrL92akrb8AKsv7HNT8WzSNbdFdbj1QbcffyN71Q+O5kcu1X JWkSjCQlh3OVJYNeGDbCxTYQL8dLs2me23lWeamejuSLydy4WOVGGNW3pG9GNsgrvWNO QpKV94F+IkTT3lCqF4uGRV2r8+s4LOvEI9TL/OlaSf06LoOQ8vm96zF1475hNSiTtzLO 373w== 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 i25-20020a0564020f1900b0046c58e79738si1806826eda.572.2022.12.06.03.24.20; Tue, 06 Dec 2022 03:24:39 -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 S233877AbiLFLIe (ORCPT + 79 others); Tue, 6 Dec 2022 06:08:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52844 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233495AbiLFLI2 (ORCPT ); Tue, 6 Dec 2022 06:08:28 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D3596B86D; Tue, 6 Dec 2022 03:08:25 -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 525D023A; Tue, 6 Dec 2022 03:08:32 -0800 (PST) Received: from [10.57.7.134] (unknown [10.57.7.134]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 803593F73D; Tue, 6 Dec 2022 03:08:22 -0800 (PST) Message-ID: Date: Tue, 6 Dec 2022 11:08:20 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 Subject: Re: [PATCH] cpufreq: schedutil: Optimize operations with single max CPU capacity Content-Language: en-US To: "Rafael J. Wysocki" Cc: Viresh Kumar , linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, dietmar.eggemann@arm.com, vincent.guittot@linaro.org, saravanak@google.com, wusamuel@google.com, isaacmanjarres@google.com, kernel-team@android.com, juri.lelli@redhat.com, peterz@infradead.org, mingo@redhat.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de References: <20221206101021.18113-1-lukasz.luba@arm.com> <20221206101629.dbcuv3zdso44w3cq@vireshk-i7> <2a97cf28-7e47-04c7-edcb-41adbd20ccd9@arm.com> From: Lukasz Luba In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.5 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 On 12/6/22 11:00, Rafael J. Wysocki wrote: > On Tue, Dec 6, 2022 at 11:30 AM Lukasz Luba wrote: >> >> >> >> On 12/6/22 10:16, Viresh Kumar wrote: >>> On 06-12-22, 10:10, Lukasz Luba wrote: >>>> The max CPU capacity is the same for all CPUs sharing frequency domain >>>> and thus 'policy' object. There is a way to avoid heavy operations >>>> in a loop for each CPU by leveraging this knowledge. Thus, simplify >>>> the looping code in the sugov_next_freq_shared() and drop heavy >>>> multiplications. Instead, use simple max() to get the highest utilization >>>> from these CPUs. This is useful for platforms with many (4 or 6) little >>>> CPUs. >>>> >>>> The max CPU capacity must be fetched every time we are called, due to >>>> difficulties during the policy setup, where we are not able to get the >>>> normalized CPU capacity at the right time. >>>> >>>> The stored value in sugov_policy::max is also than used in >>>> sugov_iowait_apply() to calculate the right boost. Thus, that field is >>>> useful to have in that sugov_policy struct. >>>> >>>> Signed-off-by: Lukasz Luba >>> >>> Can you please divide this into two patches, one for just moving max >>> and one for looping optimization ? Else we may end up reverting >>> everything once again. >>> >> >> OK, I can do that. Thanks for having a look! > > Also, please note that this material is unlikely to go into 6.2, so > I'd prefer going back to it after 6.2-rc1 is out. Yes, I understand. Thanks Rafael!