mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/2] cpufreq: governor: Apply limits with target_freq instead of policy->cur
@ 2026-02-10 11:54 Lifeng Zheng
  2026-02-10 11:54 ` [PATCH 1/2] cpufreq: governor: Move requested_freq to policy_dbs_info Lifeng Zheng
                   ` (3 more replies)
  0 siblings, 4 replies; 20+ messages in thread
From: Lifeng Zheng @ 2026-02-10 11:54 UTC (permalink / raw)
  To: rafael, viresh.kumar, mingo, peterz, juri.lelli, vincent.guittot
  Cc: dietmar.eggemann, rostedt, bsegall, mgorman, vschneid, linux-pm,
	linux-kernel, linuxarm, jonathan.cameron, zhanjie9, lihuisong,
	yubowen8, zhangpengjie2, wangzhi12, linhongye, zhenglifeng1

The motivation for this patchset cames from a test on our platform:

With conservative governor and some pressure on CPU, the frequency rapidly
reach the max supported frequency, such as 2GHz.

Later, some frequency division strategies on our platform were triggered
and the actual frequency become 500MHz -- 1/4 of the OS distribution
frequency.

At that time, if someone excecutes 'cat cpuinfo_cur_freq', the actual
frequency will become 250MHz -- 1/4 of the min supported frequency.

After the platform recovering from the frequency division, the frequency
will stay on 1GHz, until the pressure disappear.

The reason this happens is that in cpufreq_verify_current_freq(), if
policy->cur != new_freq, policy->update will be queued, which will
ultimately lead to a call to cpufreq_policy_apply_limits(), and update the
target frequency to policy->min. And then in cs_dbs_update(), since the
pressure never vanish, it will always hit the following branches:

	if (load > dbs_data->up_threshold) {
		dbs_info->down_skip = 0;

		/* if we are already at full speed then break out early */
		if (requested_freq == policy->max)
			goto out;

Therefore, the target frequency will always remain at the lowest frequency.

The branching conditions in cs_dbs_update() may not be strict enough, but
the root cause of this problem is that the target frequency was updated
when querying cpuinfo_cur_freq. For ondemand and schedutil governor,
although the frequency will not always remain at the lowest level without
rising, will still be min_freq in a short period of time when the query
action occurs.

Using the freq requested by the governor to decide whether to update the
target frequency is more reasonable in cpufreq_policy_apply_limits().

Lifeng Zheng (2):
  cpufreq: governor: Move requested_freq to policy_dbs_info
  cpufreq: governor: Apply limits with requested_freq or next_freq

 drivers/cpufreq/cpufreq_conservative.c | 14 ++++----------
 drivers/cpufreq/cpufreq_governor.c     |  3 ++-
 drivers/cpufreq/cpufreq_governor.h     | 12 ++++++++++++
 drivers/cpufreq/cpufreq_ondemand.c     | 10 +++++-----
 include/linux/cpufreq.h                |  7 ++++---
 kernel/sched/cpufreq_schedutil.c       |  4 ++--
 6 files changed, 29 insertions(+), 21 deletions(-)

-- 
2.33.0


^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2026-03-17 10:26 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-02-10 11:54 [PATCH 0/2] cpufreq: governor: Apply limits with target_freq instead of policy->cur Lifeng Zheng
2026-02-10 11:54 ` [PATCH 1/2] cpufreq: governor: Move requested_freq to policy_dbs_info Lifeng Zheng
2026-02-10 11:54 ` [PATCH 2/2] cpufreq: governor: Apply limits with requested_freq or next_freq Lifeng Zheng
2026-03-05  6:21   ` Viresh Kumar
2026-03-06  4:08     ` zhenglifeng (A)
2026-03-05 12:19 ` [PATCH 0/2] cpufreq: governor: Apply limits with target_freq instead of policy->cur Jie Zhan
2026-03-06  9:21   ` zhenglifeng (A)
2026-03-10  3:14     ` Jie Zhan
2026-03-09  8:27 ` Viresh Kumar
2026-03-09 12:32   ` Rafael J. Wysocki
2026-03-10  2:22     ` zhenglifeng (A)
2026-03-10  4:29       ` Viresh Kumar
2026-03-10 13:11         ` zhenglifeng (A)
2026-03-12  6:16           ` Viresh Kumar
2026-03-13  3:51             ` zhenglifeng (A)
2026-03-13  6:05               ` Viresh Kumar
2026-03-13 10:12                 ` zhenglifeng (A)
2026-03-17  6:20                   ` Viresh Kumar
2026-03-17  8:26                     ` zhenglifeng (A)
2026-03-17 10:26                       ` Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®