From patchwork Fri Oct 16 18:17:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Wang X-Patchwork-Id: 317819 Delivered-To: patch@linaro.org Received: by 2002:a92:d603:0:0:0:0:0 with SMTP id w3csp1693419ilm; Fri, 16 Oct 2020 11:17:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxgcmGhRyN3Gf8mNr/TXkOQskdJdE2m6+NSDhlVJTOtUikjFYGTzYsOHTR/FuC7IjvPPqEj X-Received: by 2002:a17:906:4306:: with SMTP id j6mr5256531ejm.523.1602872253086; Fri, 16 Oct 2020 11:17:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602872253; cv=none; d=google.com; s=arc-20160816; b=RNxWaryPMOA07W5TIO/TKR4WywC9J79Gnpb4lmSqXHHAGbEOilaRzP8eQI4koyP/u4 dVEGboeHKME9zOuUQ1p3/I6C/oZXED9TFg6EqR0F3RAk16AFQ3E0eWwRS9WZDFhgovop rwVinGeGXrwCHAvRspzUKCw1n9AgANGVxusrxc0fNCR5ohIwfdDhbGI9UzcUOemBuQRH uRSoUtUxSVxVz+XgNSUK3k5B1p9ayh3oGvg7GWfu25dNbLnjz1vQ7OPpaoRL1cVNagO7 5oHwxpVtFb0rTFeDQXeNk5NShwkF8kLrKKYJ8WQ8fpBtX23cEb/wl/eyPIytaHfhGWE5 UEDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:cc:from:subject:references:mime-version :message-id:in-reply-to:date:sender:dkim-signature; bh=jSjH1eyM8iVzeEs2L9+1VUmTOGY9+1KpajutAHg/TE8=; b=wVBjDo0tdrgcF/s8/+07oWkJX/4FRkrE0yFFaF38Zx90gBSL1gP/GkfVhIFKFlHCKF s2P4BtKI+aXE7xn34LQXYgpOb0E9HTsyGcpPCE9UZ5jmRrGxF/NeKfAlUdfmPkO6fTON feNs6CZMdQl82YOMRQQTIdfK3/fcb5eiB6E0ofWXChGbiAdS6kcgdE9e4qfRqMYh/9SC +qIUzSVB8nXCiQeh/iXj1vG9qAiMg/8k4esW7cb7NjwGK2MVRh5EtI+Km2Kd7nq+Pk4W xMbpWUP9P6MezDbI8Tg+4RJgOCT8LYrPZjyh/ma1YJJNyvi66Z0Kw/p0nbEE5yBGPC21 prig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=stpM8PVU; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f2si2197867ejc.542.2020.10.16.11.17.32; Fri, 16 Oct 2020 11:17:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=stpM8PVU; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391549AbgJPSRc (ORCPT + 9 others); Fri, 16 Oct 2020 14:17:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391441AbgJPSRc (ORCPT ); Fri, 16 Oct 2020 14:17:32 -0400 Received: from mail-qt1-x849.google.com (mail-qt1-x849.google.com [IPv6:2607:f8b0:4864:20::849]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB66EC061755 for ; Fri, 16 Oct 2020 11:17:31 -0700 (PDT) Received: by mail-qt1-x849.google.com with SMTP id a16so1879663qtj.7 for ; Fri, 16 Oct 2020 11:17:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:in-reply-to:message-id:mime-version:references:subject :from:cc; bh=jSjH1eyM8iVzeEs2L9+1VUmTOGY9+1KpajutAHg/TE8=; b=stpM8PVUNvapHN5s3GE6OEHXwbzMr7MaqXEB3iezjKNeivnwwyNR3KGpmNu6x4y9yU UswZlo7ZUSX34RMC/ZwjPm5rE+hc8UrG5+UDizTp0RdKJClCXsISUAO1ZWr6Z3Pcturf g2f0IVLQ7ftWZn039a+ocgXPaPqzGOuynE7yaH8fxx1W77dGedK9ar/lZj2jMybL3EQK avRl4dUR7bdVCxMwyfRka2vNbRH8dUOULVcA18YIpMqx8hjQ+ygk8+DrPv6oNRDiis2d sKS/ToQvqYgpb+MRvnTt/hib+RFrcWyB1a0BZUN45Qxg8l9OnQeTKrrEE2dl2o0pCpQh L2hA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:in-reply-to:message-id:mime-version :references:subject:from:cc; bh=jSjH1eyM8iVzeEs2L9+1VUmTOGY9+1KpajutAHg/TE8=; b=BpPNzPRaRTzDZTQkYXIm84INP3lcQw/wPWBl9Bw7qqUKw87vmOETalBoiZaZ6upvP9 QHntUkob4jb7qXqIQAavAenMsAVsN2P333LDRDVuxIP6J3d+LfVafdvhQE9V5I4wxhW7 JMq+TwBe99RgZZzfRrwW3IuJwEaPqOHRmYu6Z7Jel9lPnT6qbkGllOmXiTfTUme+UO7L VtKS8NQU9H/CPmIPRr8yGwBAVJjv/1MsScWnLd80OHdTVPnGxLGrKJf5QA/SURyhOU75 GNil7iMiNdLGR33Rhd/CvusqqJBtP5qMHOdQnhNBIVr6cG+XuFfEVO7tP4LqFEa5NJkQ 1jzw== X-Gm-Message-State: AOAM531Ad9NHkDpf2ASyyblCc2WRtdm5m+k9EQS4wBKQfXvxhbT+bfaE 1xy6KCEsxheVvwgzkTDyaWcZyf4= Sender: "wvw via sendgmr" X-Received: from wvw-pc.mtv.corp.google.com ([2620:15c:211:1:f693:9fff:fef4:4f9b]) (user=wvw job=sendgmr) by 2002:ad4:45ec:: with SMTP id q12mr5445691qvu.33.1602872250940; Fri, 16 Oct 2020 11:17:30 -0700 (PDT) Date: Fri, 16 Oct 2020 11:17:22 -0700 In-Reply-To: Message-Id: <20201016181722.884812-1-wvw@google.com> Mime-Version: 1.0 References: X-Mailer: git-send-email 2.29.0.rc1.297.gfa9743e501-goog Subject: [PATCH] sched: cpufreq_schedutil: restore cached freq when next_f is not changed From: Wei Wang Cc: wei.vince.wang@gmail.com, viresh.kumar@linaro.org, qperret@google.com, rafael@kernel.org, Wei Wang , "Rafael J. Wysocki" , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org We have the raw cached freq to reduce the chance in calling cpufreq driver where it could be costly in some arch/SoC. Currently, the raw cached freq will be reset when next_f is changed for correctness. This patch changes it to maintain the cached value instead of dropping it to honor the purpose of the cached value. This is adapted from https://android-review.googlesource.com/1352810/ Signed-off-by: Wei Wang --- kernel/sched/cpufreq_schedutil.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) -- 2.29.0.rc1.297.gfa9743e501-goog Acked-by: Viresh Kumar diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c index 5ae7b4e6e8d6..e254745a82cb 100644 --- a/kernel/sched/cpufreq_schedutil.c +++ b/kernel/sched/cpufreq_schedutil.c @@ -441,6 +441,7 @@ static void sugov_update_single(struct update_util_data *hook, u64 time, unsigned long util, max; unsigned int next_f; bool busy; + unsigned int cached_freq = sg_policy->cached_raw_freq; sugov_iowait_boost(sg_cpu, time, flags); sg_cpu->last_update = time; @@ -464,8 +465,8 @@ static void sugov_update_single(struct update_util_data *hook, u64 time, if (busy && next_f < sg_policy->next_freq) { next_f = sg_policy->next_freq; - /* Reset cached freq as next_freq has changed */ - sg_policy->cached_raw_freq = 0; + /* Restore cached freq as next_freq has changed */ + sg_policy->cached_raw_freq = cached_freq; } /*