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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6D403C352A1 for ; Tue, 6 Dec 2022 11:08:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233672AbiLFLI3 (ORCPT ); Tue, 6 Dec 2022 06:08:29 -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 Precedence: bulk List-ID: X-Mailing-List: linux-pm@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!