Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp3295825pxu; Mon, 19 Oct 2020 08:42:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyMebMirETPiirRu+cD+pDbqPl7vT7hPnfcLgJ4Pqqri2s1DAAbNCxZ/zr1pZ9n39Fcvpct X-Received: by 2002:a17:906:38d8:: with SMTP id r24mr529137ejd.32.1603122122739; Mon, 19 Oct 2020 08:42:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603122122; cv=none; d=google.com; s=arc-20160816; b=AXwq/ojNzJv7lWgr9S0aYFWIv9RkSL5NI7IvRv+VuHjI5AaLikA3DaLsUb8p8JWlJ0 OAJSi5iJk5lM2YBOhaKWVSz1G7uHSKhn6B0VbIpL/vPtAwX+7IqrZaA1PlrPmQ49xca3 emGkQkSWSrPVPkQRsw+vUxbTRPiDjvJGWMHUdic9gmT1+k8xeAXigysccrgQaql92NP/ FeKQoEIX7nyD3Sh1ZKgMvfqv73ecXAAOMcY5LQPglBZHT7TdpUCgTTACRbVaET1iI9hM OQTcRQFS3Xws1JqJdqYHPIGExgUsri3bT4YosbNdMdEiRwTlFECArN6C+a3eX1SfbLrN Fsew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=sQXDksdWJB9OPOkEy4qlnDk19u+YPFVgLo+Sa2g/Kho=; b=CTY5epJMx7HKEDQGwS/PcuwOC+FQr99GHtQKW9VNGTZtsq/vS017vIK7WM7RBWD0zk bik3vfeDSRJ8bn0SRRXpXovaAU+H6bZg4UaDNyfH2PnD/iUlFKleo/kGhH0cqNaVFxTd E371ZK5mctsASwqQe9SDRtjkgoWI7prfUah9YuX9oK/RiNKVm0z7d8oKa3uvztNtc/li hym6FAhlnvQGBXBHVyzNUUV/4iUWf8NDmFhjS57WdvPfG6n/QuBWmrxdsnyC8hhGPriK 4zMealZFVCoWRAduTRd2Qx2Dg4rGXt+ep8zcXDmNcVxEkmi/1RGt6ITXTawS4xxis+S8 uAVA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v3si7675edd.408.2020.10.19.08.41.39; Mon, 19 Oct 2020 08:42:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730025AbgJSPkD (ORCPT + 99 others); Mon, 19 Oct 2020 11:40:03 -0400 Received: from mail-ot1-f67.google.com ([209.85.210.67]:43953 "EHLO mail-ot1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729075AbgJSPkC (ORCPT ); Mon, 19 Oct 2020 11:40:02 -0400 Received: by mail-ot1-f67.google.com with SMTP id k68so6422415otk.10; Mon, 19 Oct 2020 08:40:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=sQXDksdWJB9OPOkEy4qlnDk19u+YPFVgLo+Sa2g/Kho=; b=OQjvnSQZbqZoff/o1/9S3Cxm+FCAs+VPOmMFjejuvAYsrEDyEb4s92f1AVXjPwbkNl OZDMpWyuePDLSKsiU9+j2fyNS7alwFVcfHX3Kt3j0FPdbEy4eFjJgAQvDPhZCdNLdGn/ W7LDX4SP52tbDGKOgi6kiyMUb+ripD61w+WnxyNtfaBt4Mho8fHu4cCQLPZoKZWPUSWK xrbbgCZV7G6EfeOd8FWjJ7QK88s+r9SyFCIilh5iF7Z1x/Diw4A5EJH1bN+NRTTYVIDl 9SJuo7pif39chQTnYcwFM8mhAcZ1ZC5edVChiY+Kwj+CLUfOyVH8RwvAHmFXvOClwJTL x13Q== X-Gm-Message-State: AOAM5302Gle0wvmYfEK+IXJ000ceAcsSkwuPwX9ZLHO6/n1cioWYs9B3 cyjZ+hFrf8IIcqJYeqQfhYkWCmuCo4Lm0zA7ths= X-Received: by 2002:a05:6830:18cd:: with SMTP id v13mr447185ote.206.1603122001657; Mon, 19 Oct 2020 08:40:01 -0700 (PDT) MIME-Version: 1.0 References: <20201016181722.884812-1-wvw@google.com> In-Reply-To: <20201016181722.884812-1-wvw@google.com> From: "Rafael J. Wysocki" Date: Mon, 19 Oct 2020 17:39:50 +0200 Message-ID: Subject: Re: [PATCH] sched: cpufreq_schedutil: restore cached freq when next_f is not changed To: Wei Wang Cc: Wei Wang , Viresh Kumar , Quentin Perret , "Rafael J. Wysocki" , "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 , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 16, 2020 at 8:17 PM Wei Wang wrote: > > 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(-) > > 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; > } > > /* > -- Applied as 5.10-rc material with edited subject and rewritten changelog. Thanks!