Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp399581rwb; Wed, 7 Dec 2022 20:17:41 -0800 (PST) X-Google-Smtp-Source: AA0mqf6f4RN5aWcKf6txLVvG6uxaPp0xMj+Ps+eNe/h2txuFUS+C5+UlXv3FwOBWBYUSNYUy3eki X-Received: by 2002:aa7:d911:0:b0:46b:c156:9945 with SMTP id a17-20020aa7d911000000b0046bc1569945mr30005571edr.350.1670473061169; Wed, 07 Dec 2022 20:17:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670473061; cv=none; d=google.com; s=arc-20160816; b=VBrc0lQTJcqzdm2SwiJ1evGRczOthrgfwnviEl/NEVzYqeESTNfDfhHhnN8Ijr9X1A 9L9ZGzavqwZUvb5CP7rPXC0oJoLmxuBt5c7wCCfmskUTuKVnrxFVOG6ZZ7vhuQGqib0U Lnvk4YfYZ3xumFznG2Skg6+So1K//c+G3O/w6w5FoNmbDG+CRnDfmXPtF9slzXWV/BWH kQfxij+L/3V4ML04fG7QeeKYE8wOm8vtbhfd63j59h10lyivAFkhsCZKceBj22PfyFrS wlwdBWoDTzgOCLx2/tAiBg+Yq+hJQxG/ASIfKbzsPq7nC9HwGsQ1/Itbt/lSy0UaBmeF ySwg== 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=hunJBYHsFf+Z6ONJcd5pZZLsPxJbVZOYvwp3Lj446lM=; b=VC1lGtdFqQCrHlLrEt7czVdEaK8Ftkz/p63dPUkDqsSMeUaTIB+tZtNcmG/ogt4OvS qViDbVGFCquF9ldh3r5tGV7tdblriyEfCnKCqFtk+JFxpPb0LU+KC3enOVje/fmtK4VR Ms+8fMnCo5C88d2jBCyxwJiQjs+fWa+EEFjbe9uwQFaYLGxguEa2tOdFnLRRL1bqJDU5 omc3ZBx3ncTzpuuzmwZ+bcRsdZm6q5T3r7QkMvjXhr3cmQQbT5ScGjTjrlb1mgPy/FUH kRQOYhaHlEVDFokjckmc/0pnfLs4S9ABG6MzYao5vmJcPCQh25HKCTDw7jkzDdK1YDss LPFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nvQbINZC; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sb38-20020a1709076da600b007c10d4bddccsi5200771ejc.822.2022.12.07.20.17.17; Wed, 07 Dec 2022 20:17:41 -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; dkim=pass header.i=@linaro.org header.s=google header.b=nvQbINZC; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229507AbiLHEJb (ORCPT + 75 others); Wed, 7 Dec 2022 23:09:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56430 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229602AbiLHEJa (ORCPT ); Wed, 7 Dec 2022 23:09:30 -0500 Received: from mail-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CEA898D655 for ; Wed, 7 Dec 2022 20:09:28 -0800 (PST) Received: by mail-pl1-x629.google.com with SMTP id 4so408506pli.0 for ; Wed, 07 Dec 2022 20:09:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=hunJBYHsFf+Z6ONJcd5pZZLsPxJbVZOYvwp3Lj446lM=; b=nvQbINZCuWy31KkXFJkiCtfBYXylSRoUyBDiOOmFeROr/jHoahgK6POXLR7S6FHGkB OEymcGAjmYB+imapqxfOY3PwwH6c2en7F6vay/6EVqibdKKSgCGQzG3zr0JTnsnjiN2X 12jaayEN5rBujyCGm7czLnJTpDPKDExxleDFOsaNFkppO7UjnS+n5Qauq867asFr23rU Zlrd9HP1Is3rDT/l7PxJx3XPe6N+f9U65/im7Fu+KR1Vw8XvUnW9j51UUUKpNA3jo3lJ 1Tdd6PlZjh5a0RX9Xge3y67mdcPgEwkJwl6SpRgA9NxvYmZ0Jc+hGT5viyejmbolWpbh UbrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=hunJBYHsFf+Z6ONJcd5pZZLsPxJbVZOYvwp3Lj446lM=; b=IiyThAerOT3r7TJ7RY54kde7Was62QM3Xn0D8tPZhCTYUW23j94RhxwmGtyksw4OgE DQdr5Rzbtfu06X7HuqinTJhiXKw+kUf6KIzhi/vwfOH1xEf9S02wHaKlCYVnCmEZyNiV KMU6hMcHRNB0Ie+BzoZJqK6zh92MczrvxfMLOKDQHocdY/QNUcWLGpsmCelYYbZE2nQY q72b3w7m6OTBmqtzetnLXlsmSma33sp60Ia4FWupew1tvzqwIriRRbQE1x0x7rmVgxxS gDC0aT07UvJ1CxICDMZluvYOE9Cw+RsjzPD98CKvcbM2w2h+7yO3dZGHkLRaW/cbLT2b 6U5g== X-Gm-Message-State: ANoB5pmRi18WXs0PWqPTC7KCeyLwMIAsnz7qeJUYraPgAksFe7v2DsUI mXvg7Ur4Qp1itlPlLE2uD48buw== X-Received: by 2002:a17:90a:5581:b0:219:b015:58d5 with SMTP id c1-20020a17090a558100b00219b01558d5mr22663434pji.199.1670472568310; Wed, 07 Dec 2022 20:09:28 -0800 (PST) Received: from localhost ([122.172.87.149]) by smtp.gmail.com with ESMTPSA id w10-20020a170902e88a00b001868ed86a95sm15393369plg.174.2022.12.07.20.09.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Dec 2022 20:09:26 -0800 (PST) Date: Thu, 8 Dec 2022 09:39:21 +0530 From: Viresh Kumar To: Lukasz Luba 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 Subject: Re: [PATCH v2 2/2] cpufreq: schedutil: Optimize operations with single max CPU capacity Message-ID: <20221208040921.tgwegk7fvdm4nkiu@vireshk-i7> References: <20221207101705.9460-1-lukasz.luba@arm.com> <20221207101705.9460-3-lukasz.luba@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221207101705.9460-3-lukasz.luba@arm.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 07-12-22, 10:17, 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 > --- > kernel/sched/cpufreq_schedutil.c | 22 +++++++++++----------- > 1 file changed, 11 insertions(+), 11 deletions(-) Looks okay to me. Acked-by: Viresh Kumar -- viresh