Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp7226748rwb; Tue, 6 Dec 2022 03:01:59 -0800 (PST) X-Google-Smtp-Source: AA0mqf5pGNLsm1SBrKR8taOBCJMYg1XqPpCtUxoXSzyPlyecMtPdpYG1P6bV8GYpXbnWt9klkxPv X-Received: by 2002:a05:6402:2a08:b0:461:5e99:a299 with SMTP id ey8-20020a0564022a0800b004615e99a299mr76564010edb.40.1670324519756; Tue, 06 Dec 2022 03:01:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670324519; cv=none; d=google.com; s=arc-20160816; b=vMXAEp+aMmgzAgtkwgiTcBavPR4zKBApG5AfYz6QjP+b+Vl4evvYafQUXiizZ4CniH blOdOCjOH976gNOq8bGNtiF1y73QXYYVy+Qs/0P7dmSMRy+X0BZbq9HUfAr7aALo2SMu veJV0Eo8KVYtHHWR+OoV7Y7fJW48RU+09TgDiHChhXyZAQ9TmNww2z+SbAjdou4uSVk5 RRh14DDR5NR+nnJvVYmlLUM0o77nroC3vYO0Pkc9pE37qcZAJCishf+VSJK4pkx7b8AJ FACce0smf15KPIKqfQU40a6fSRv0g57Y9GFuyDhLH1KcoOQvoZO0sTwo1/+ra2jISCiW 6dAQ== 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=nwwoFIfgmxdE017SFMlZ/XuwWVRa4mOfdbZKIWxIjl0=; b=drhh15SEu85wfxOU+gM+d6/+l5VePoJnDhCyJqoc2zuXBhNEcv2BtJqVenBlElZXqD mtvDnlZ3GKSY4lrBIOjD3Dq/aV3Wy9MiGBv0aRmx0TdhKQfOZ3sEOE0MYkg7E0Igqe9t c0kZP3JJgqB6xEaFYOTysMUVfspcgPWu+Zt/fX+nKnSMxQC6BWGVMWyo4VmQ6ujmBBaw jFUUWITZSnA60O7u2xXPvJN7jOhVnnIRY4cOrm3LreMP4H1ZqFSHVKTRuvetjUurUHot NmQPhvjVb04/YwmXhJosiGkJyLrYn7ERfRfwQgba1cYHBU32B+VRL3pFTI6i+7P7xujC 3Eew== 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 r21-20020a056402019500b004699e89601dsi1532574edv.588.2022.12.06.03.01.39; Tue, 06 Dec 2022 03:01:59 -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 S230262AbiLFKaG (ORCPT + 79 others); Tue, 6 Dec 2022 05:30:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34400 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231434AbiLFKaE (ORCPT ); Tue, 6 Dec 2022 05:30:04 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 2C17919030; Tue, 6 Dec 2022 02:30:03 -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 9FA4623A; Tue, 6 Dec 2022 02:30:09 -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 36CDC3F73B; Tue, 6 Dec 2022 02:30:00 -0800 (PST) Message-ID: <2a97cf28-7e47-04c7-edcb-41adbd20ccd9@arm.com> Date: Tue, 6 Dec 2022 10:29:58 +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: Viresh Kumar Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, rafael@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> From: Lukasz Luba In-Reply-To: <20221206101629.dbcuv3zdso44w3cq@vireshk-i7> 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 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!