Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I am a beginner in Linux. I want implement patch for changing a CPU frequency governor.But I don't know what is patch and Governor in Linux and I don't know where I can start from? Please help me with an example.

share|improve this question

closed as not a real question by Gilles, jasonwryan, Renan, warl0ck, Mat Dec 28 '12 at 6:37

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

2  
Governor of what? –  peterph Dec 27 '12 at 14:15
    
@ peterph I want change Governor of Powersave .please help me –  linux Dec 27 '12 at 14:29
    
jeez, why is it called a governor ? –  amphibient Dec 27 '12 at 15:25
    
@foampile I edit my question .any idea? –  linux Dec 27 '12 at 15:36
    
I am confident your question would receive a better response if you could manage to more fully describe what you are doing. This implies also that you give some information about what Governer you mean. The same thing is true for the patch you want to implement. You need to tell what source code you intent to patch. Sometimes it is hard and you are a beginner so I hope you keep face and manage to express you question in a way that will generate you some help. People here are helpful, but have trouble understanding you, I guess –  humanityANDpeace Dec 28 '12 at 18:33

1 Answer 1

up vote 2 down vote accepted

If you want to change the CPU frequency governor (which of course affects the overall battery time), you need to write to files located in /sys/devices/system/cpu/cpuN/cpufreq (at least that's where they tend to be on most systems with not-too-old kernels), where N is the number of the CPU core. scaling_available_governors contains a list of available governors. You can use one of those by writing its name to scaling_governor. No need for C/C++, shell one-liner

echo {selected_governor} > /sys/.../cpufreq

is sufficient. Be aware, that on a multicore machine it can change stuff for more than one and/or not all CPUs (get a list from the affected_cpus file).

The easiest (and safest) way, is to use cpufreq-utils.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.