cpufreq_get_requested_power(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– cpufreq_get_requested_power(9) πŸ’–

okay so bestie, this is a page from the Kernel API Manual and honestly it's giving "thermal management but make it cute". Let's get into it ✨


πŸŽ€ NAME πŸŽ€

cpufreq_get_requested_power β€” get the current power


✨ SYNOPSIS ✨

int cpufreq_get_requested_power (struct thermal_cooling_device *cdev ,
u32 *power );

🌸 ARGUMENTS 🌸

  • cdev β€” a thermal_cooling_device pointer, iykyk 🫢
  • power β€” the pointer where we're gonna stash the resulting power, no cap

πŸ¦‹ DESCRIPTION πŸ¦‹

So the whole glowy mission here: calculate the current power consumption of the cpus in milliwatts and store it in power. Slay. ⚑

now, real talk β€” this function should actually calculate the requested power, but ngl that's hard. Like, genuinely hard. Getting the frequency that cpufreq would have assigned if there were no thermal limits? That's the dream, but it's not it. Instead, we calculate the current power on the assumption that the immediate future will look like the immediate past. main character energy: past behavior predicts future vibes πŸ’…

We use the current frequency and the average load since this function was last called. And like β€” in reality there could have been multiple opps since this function was last called, and that lowkey affects the load calculation. So it's not perfectly accurate, but this simplification is good enough and it works. Fr fr.

REVISIT this, as more complex code may be needed if experiments show that it's not accurate enough. πŸ‘€ (yes that's literally in the original, it's a vibe check for future maintainers)

πŸ’€ RETURN πŸ’€

0 on success β€” and that's it, bestie, this function doesn't fail. Not once. Iconic. πŸ‘‘


🌈 SEE ALSO 🌈

like, go read those too, they're all part of the same friend group 🫢✨


and that's the whole page!! πŸŽ€ sign-off time: this lil beauty lives in ./drivers/thermal, dated October 2026, and it's filed under cpufreq_get_requested_power(9). mwah πŸ’‹ stay cool (literally, it's a cooling device) πŸŒΈπŸ’œ

πŸ“¦ where this page comes from