cpufreq_driver_fast_switch(9)
β¨ cpufreq_driver_fast_switch β¨
okay bestie, buckle up β this is a page from the Kernel API Manual (section 9, kernel developer vibes only π ) and it's literally about changing a CPU's clock speed without going to sleep. iconic behavior honestly.
π NAME π
cpufreq_driver_fast_switch β carry out a fast CPU frequency switch. that's it, that's the whole job. speed. no napping. periodt. π₯
πΈ SYNOPSIS πΈ
unsigned int cpufreq_driver_fast_switch(struct cpufreq_policy *policy,
unsigned int target_freq);
two args, one unsigned int back. short and sweet, the way we like it π«Ά
π ARGUMENTS π
policyβ the cpufreq policy you're switching the frequency for. like, which CPU crew we're doing this to π§target_freqβ the new frequency you want to set. and ngl, it may be approximate β you're giving a vibe, not a promise β¨
π¦ DESCRIPTION π¦
carry out a fast frequency switch without sleeping. yes bestie, no sleeping on the job π΄π«
the driver's ->fast_switch callback that this function invokes? it has to be suitable for being called from within RCU-sched read-side critical sections. so like, no funny business in there. it's also expected to select the minimum available frequency greater than or equal to target_freq β that's CPUFREQ_RELATION_L, iykyk π
π¨ important, bestie: this function must not be called if policy->fast_switch_enabled is unset. unset = hard no. do not pass go. do not collect $200 π
governors that call this function have to guarantee two things, fr fr:
- it will never be invoked twice in parallel for the same policy
- it will never be called in parallel with either
->targetor->target_indexfor the same policy
basically: one at a time, no overlapping, we're not doing chaos today π
returns the actual frequency set for the CPU. π―
and if the driver's ->fast_switch callback returns 0 to indicate an error condition β bestie, the hardware configuration must be preserved. don't touch anything, just back away slowly π
π SEE ALSO π
kernel file ./drivers/cpufreq/cpufreq.c β and the whole extended family, all invited to the group chat π«Ά:
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_adjust_perf(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)
π« and that's the page, bestie π«
this little masterpiece lives in ./drivers/cpufreq, comes to you courtesy of the Kernel API Manual, and was dated October 2026 β go forth and switch frequencies fast, safely, and with main character energy ππ
π¦ 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