From nobody Thu Apr 2 15:42:30 2026 Received: from canpmsgout07.his.huawei.com (canpmsgout07.his.huawei.com [113.46.200.222]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E67543271FD; Tue, 10 Feb 2026 11:56:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=113.46.200.222 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770724590; cv=none; b=DC08vga28n6n6WeSViaPy+YgLTtmHJhNUl0qtK52iEJRvEQVYy7OXQ1EzzAqouuUVAhoxoMiIn96Yd0r8+OIlfJ9NGvg5pQUR/XIZD3HK3EElxoSrbcSkynhbbzLRSNGIBHX8ndo1ta0m5rJx2hc/RSjAkX0QEYxmAMQWz7T1lM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770724590; c=relaxed/simple; bh=2cDa0jQh4BLNwvHRHhy5tWEKBg2vJbZED/67EOm3xVA=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=RDPZ5hx9YiRXJZTszwSenCCOr05WFBhk4vf+acFyRwp47OnFDSs3fcLdlD/AAOxJK7NwBbLydGujh5w/mkhmLcVff7zfqEs9xsi7E6uZUIbiRDJQ4Lkx+gQ05vii6HcfWfcD40JQwtlJe5upMD0RD4/4foO3IwxyqBGAvRVWAJ0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b=DUaTAaQm; arc=none smtp.client-ip=113.46.200.222 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b="DUaTAaQm" dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=Zp2BHvySpCxWBmHqdxSZ5PZi/J2OrljwE43C5Nhh+xg=; b=DUaTAaQmB7GvKabIgfEj7ll2nd9t8ISbTCHhTh2kcCFqMfN3uR1zeinGsBGlh4dUVMy0flwGL TLTC84VzElJCn7Tcd5+K8OL8Ij3tv8Xoa3RpoNM1GT9WRXn2NqG1DYvM8JB/G86FG704md7IH5a scnaUvagzSRykJKB03R8n4o= Received: from mail.maildlp.com (unknown [172.19.162.92]) by canpmsgout07.his.huawei.com (SkyGuard) with ESMTPS id 4f9KfQ0DXGzLlSM; Tue, 10 Feb 2026 19:51:42 +0800 (CST) Received: from kwepemf200001.china.huawei.com (unknown [7.202.181.227]) by mail.maildlp.com (Postfix) with ESMTPS id A6B2940565; Tue, 10 Feb 2026 19:56:19 +0800 (CST) Received: from localhost.localdomain (10.50.163.32) by kwepemf200001.china.huawei.com (7.202.181.227) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Tue, 10 Feb 2026 19:56:18 +0800 From: Lifeng Zheng To: , , , , , CC: , , , , , , , , , , , , , , , Subject: [PATCH 1/2] cpufreq: governor: Move requested_freq to policy_dbs_info Date: Tue, 10 Feb 2026 19:54:57 +0800 Message-ID: <20260210115458.3493646-2-zhenglifeng1@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20260210115458.3493646-1-zhenglifeng1@huawei.com> References: <20260210115458.3493646-1-zhenglifeng1@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: kwepems500002.china.huawei.com (7.221.188.17) To kwepemf200001.china.huawei.com (7.202.181.227) Content-Type: text/plain; charset="utf-8" Conservative governor uses requested_freq to store the last target freq requested by the governor. This member variable can also be useful for the ondemand governor. So move it to struct policy_dbs_info and update it each time request a frequency. Signed-off-by: Lifeng Zheng --- drivers/cpufreq/cpufreq_conservative.c | 14 ++++---------- drivers/cpufreq/cpufreq_governor.c | 1 + drivers/cpufreq/cpufreq_governor.h | 12 ++++++++++++ drivers/cpufreq/cpufreq_ondemand.c | 10 +++++----- 4 files changed, 22 insertions(+), 15 deletions(-) diff --git a/drivers/cpufreq/cpufreq_conservative.c b/drivers/cpufreq/cpufr= eq_conservative.c index cce6a8d113e1..2980ca19c580 100644 --- a/drivers/cpufreq/cpufreq_conservative.c +++ b/drivers/cpufreq/cpufreq_conservative.c @@ -14,7 +14,6 @@ struct cs_policy_dbs_info { struct policy_dbs_info policy_dbs; unsigned int down_skip; - unsigned int requested_freq; }; =20 static inline struct cs_policy_dbs_info *to_dbs_info(struct policy_dbs_inf= o *policy_dbs) @@ -59,7 +58,7 @@ static unsigned int cs_dbs_update(struct cpufreq_policy *= policy) { struct policy_dbs_info *policy_dbs =3D policy->governor_data; struct cs_policy_dbs_info *dbs_info =3D to_dbs_info(policy_dbs); - unsigned int requested_freq =3D dbs_info->requested_freq; + unsigned int requested_freq =3D policy_dbs->requested_freq; struct dbs_data *dbs_data =3D policy_dbs->dbs_data; struct cs_dbs_tuners *cs_tuners =3D dbs_data->tuners; unsigned int load =3D dbs_update(policy); @@ -79,7 +78,7 @@ static unsigned int cs_dbs_update(struct cpufreq_policy *= policy) */ if (requested_freq > policy->max || requested_freq < policy->min) { requested_freq =3D policy->cur; - dbs_info->requested_freq =3D requested_freq; + policy_dbs->requested_freq =3D requested_freq; } =20 freq_step =3D get_freq_step(cs_tuners, policy); @@ -111,9 +110,7 @@ static unsigned int cs_dbs_update(struct cpufreq_policy= *policy) if (requested_freq > policy->max) requested_freq =3D policy->max; =20 - __cpufreq_driver_target(policy, requested_freq, - CPUFREQ_RELATION_HE); - dbs_info->requested_freq =3D requested_freq; + gov_freq_request(policy, requested_freq, CPUFREQ_RELATION_HE); goto out; } =20 @@ -135,9 +132,7 @@ static unsigned int cs_dbs_update(struct cpufreq_policy= *policy) else requested_freq =3D policy->min; =20 - __cpufreq_driver_target(policy, requested_freq, - CPUFREQ_RELATION_LE); - dbs_info->requested_freq =3D requested_freq; + gov_freq_request(policy, requested_freq, CPUFREQ_RELATION_LE); } =20 out: @@ -310,7 +305,6 @@ static void cs_start(struct cpufreq_policy *policy) struct cs_policy_dbs_info *dbs_info =3D to_dbs_info(policy->governor_data= ); =20 dbs_info->down_skip =3D 0; - dbs_info->requested_freq =3D policy->cur; } =20 static struct dbs_governor cs_governor =3D { diff --git a/drivers/cpufreq/cpufreq_governor.c b/drivers/cpufreq/cpufreq_g= overnor.c index 1a7fcaf39cc9..7ec38407230f 100644 --- a/drivers/cpufreq/cpufreq_governor.c +++ b/drivers/cpufreq/cpufreq_governor.c @@ -524,6 +524,7 @@ int cpufreq_dbs_governor_start(struct cpufreq_policy *p= olicy) =20 policy_dbs->is_shared =3D policy_is_shared(policy); policy_dbs->rate_mult =3D 1; + policy_dbs->requested_freq =3D policy->cur; =20 sampling_rate =3D dbs_data->sampling_rate; ignore_nice =3D dbs_data->ignore_nice_load; diff --git a/drivers/cpufreq/cpufreq_governor.h b/drivers/cpufreq/cpufreq_g= overnor.h index 168c23fd7fca..51db1abced93 100644 --- a/drivers/cpufreq/cpufreq_governor.h +++ b/drivers/cpufreq/cpufreq_governor.h @@ -97,6 +97,8 @@ struct policy_dbs_info { /* Status indicators */ bool is_shared; /* This object is used by multiple CPUs */ bool work_in_progress; /* Work is being queued up or in progress */ + + unsigned int requested_freq; /* Last frequency requested by the governor = */ }; =20 static inline void gov_update_sample_delay(struct policy_dbs_info *policy_= dbs, @@ -105,6 +107,16 @@ static inline void gov_update_sample_delay(struct poli= cy_dbs_info *policy_dbs, policy_dbs->sample_delay_ns =3D delay_us * NSEC_PER_USEC; } =20 +static inline void gov_freq_request(struct cpufreq_policy *policy, + unsigned int requested_freq, + unsigned int relation) +{ + struct policy_dbs_info *policy_dbs =3D policy->governor_data; + + __cpufreq_driver_target(policy, requested_freq, relation); + policy_dbs->requested_freq =3D requested_freq; +} + /* Per cpu structures */ struct cpu_dbs_info { u64 prev_cpu_idle; diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_o= ndemand.c index a6ecc203f7b7..fb6d4183d589 100644 --- a/drivers/cpufreq/cpufreq_ondemand.c +++ b/drivers/cpufreq/cpufreq_ondemand.c @@ -101,8 +101,8 @@ static void dbs_freq_increase(struct cpufreq_policy *po= licy, unsigned int freq) else if (policy->cur =3D=3D policy->max) return; =20 - __cpufreq_driver_target(policy, freq, od_tuners->powersave_bias ? - CPUFREQ_RELATION_LE : CPUFREQ_RELATION_HE); + gov_freq_request(policy, freq, od_tuners->powersave_bias ? + CPUFREQ_RELATION_LE : CPUFREQ_RELATION_HE); } =20 /* @@ -142,7 +142,7 @@ static void od_update(struct cpufreq_policy *policy) freq_next, CPUFREQ_RELATION_LE); =20 - __cpufreq_driver_target(policy, freq_next, CPUFREQ_RELATION_CE); + gov_freq_request(policy, freq_next, CPUFREQ_RELATION_CE); } } =20 @@ -160,8 +160,8 @@ static unsigned int od_dbs_update(struct cpufreq_policy= *policy) * it then. */ if (sample_type =3D=3D OD_SUB_SAMPLE && policy_dbs->sample_delay_ns > 0) { - __cpufreq_driver_target(policy, dbs_info->freq_lo, - CPUFREQ_RELATION_HE); + gov_freq_request(policy, dbs_info->freq_lo, + CPUFREQ_RELATION_HE); return dbs_info->freq_lo_delay_us; } =20 --=20 2.33.0