cpufreq_driver_adjust_perf(9)
π cpufreq_driver_adjust_perf(9) β Kernel API Manual, bestie edition π
okay so you're in the kernel API manual (cpufreq_driver_adjust_perf(9)) and you found the function that adjusts CPU performance level in one go. one go!! no half measures. let's get into it β¨
πΈ SYNOPSIS πΈ
void cpufreq_driver_adjust_perf (struct cpufreq_policy *policy ,
unsigned long min_perf , unsigned long target_perf , unsigned long
max_perf , unsigned long capacity );
like, five args, one call, no sleeping, we move π
π¦ ARGUMENTS π¦
policyβ the cpufreq policy object of the target CPU. it's giving "who am i doing this for" energy.min_perfβ the minimum (required) performance level, in units of capacity. the floor, the bare minimum, the "at least this much" π₯Ίtarget_perfβ the target (desired) performance level, in units of capacity. the dream. the goal. the main character number.max_perfβ the maximum (allowed) performance level, in units of capacity. the ceiling, the limit, the "bestie no further" πcapacityβ the capacity of the target CPU. iykyk.
π DESCRIPTION π
So basically: this carries out a fast performance level adjustment for the CPU represented by policy without sleeping. no naps. none. it's awake and it's working π₯
The driver's ->adjust_perf callback invoked by this function must be suitable for calling from within RCU-sched read-side critical sections β and it's expected to program the processor to select suitable performance levels between min_perf and max_perf inclusive, and preferably close to target_perf going forward for the CPU represented by policy. so: stay in the range, aim for the vibe, look cute doing it π
β οΈ Do NOT call this function if policy->fast_switch_enabled is unset. literally don't. that's the vibe check and you failed it π
Governors calling this function must guarantee two things, and these are non-negotiable fr fr:
- it will never be invoked twice in parallel for the same CPU, and
- it will never be called in parallel with either
->targetor->target_indexor->fast_switchfor the same CPU.
no overlapping calls, no crossover episodes, no parallel chaos. periodt. π
π SEE ALSO π
Kernel file ./drivers/cpufreq/cpufreq.c β and the whole friend group, no one left out:
cpufreq_cpu_get(9)cpufreq_cpu_put(9)adjust_jiffies(9)cpufreq_notify_transition(9)cpufreq_enable_fast_switch(9)cpufreq_disable_fast_switch(9)cpufreq_driver_resolve_freq(9)cpufreq_parse_governor(9)cpufreq_add_dev(9)cpufreq_out_of_sync(9)cpufreq_quick_get(9)cpufreq_quick_get_max(9)cpufreq_get_hw_max_freq(9)cpufreq_get(9)cpufreq_suspend(9)cpufreq_resume(9)cpufreq_driver_test_flags(9)cpufreq_get_current_driver(9)cpufreq_get_driver_data(9)cpufreq_register_notifier(9)cpufreq_unregister_notifier(9)cpufreq_driver_fast_switch(9)cpufreq_driver_has_adjust_perf(9)cpufreq_update_pressure(9)cpufreq_set_policy(9)cpufreq_update_policy(9)cpufreq_update_limits(9)cpufreq_register_driver(9)
anyway that's the whole page, hope it ate π this one lives in ./drivers/cpufreq, dated October 2026, and it goes by cpufreq_driver_adjust_perf(9) β mwah, bye bestie! ππ§β¨
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms