cpufreq_driver_fast_switch(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ 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 ->target or ->target_index for 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 🫢:


πŸ’« 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