[Pm-utils] fix cpufreq governor setting on dualcore machines

Stefan Seyfried seife at suse.de
Wed Mar 14 10:47:37 PDT 2007


On Wed, Mar 14, 2007 at 11:36:41AM -0400, Peter Jones wrote:
> On Tue, 2007-03-13 at 18:23 +0100, Stefan Seyfried wrote:
> 
> > https://bugzilla.novell.com/show_bug.cgi?id=227854#c13 sums it up nicely.
> > On dualcore cpus, where the governor setting affects more than one core,
> > the cpufreq policy will be set to performance after resume.
> 
> The idea is certainly correct, but I still hate setting the governor to
> "performance".  Realizing that we're never going to agree on this, I've
> added a config variable "TEMPORARY_CPUFREQ_GOVERNOR" that distros can
> set in 'defaults' (but I have not set it there), so that you can at
> least easily override my stubbornness.

That's fine with me, although i agree with Holger that userspace is not
the best choice for this one and performance is (at least for suspend to
disk) most useful. And this is from me, a real battery-lifetime-junkie :-)

> cvs diff: Diffing pm/hooks
> Index: pm/hooks/94cpufreq
> ===================================================================
> RCS file: /cvs/pm-utils/pm-utils/pm/hooks/94cpufreq,v
> retrieving revision 1.3
> diff -u -p -r1.3 94cpufreq
> --- pm/hooks/94cpufreq  6 Mar 2007 19:55:31 -0000       1.3
> +++ pm/hooks/94cpufreq  14 Mar 2007 15:32:10 -0000
> @@ -11,7 +11,15 @@ hibernate_cpufreq()
>                 [ -f $x/cpufreq/scaling_governor ] || continue
>  
>                 savestate ${x}_governor $(cat $x/cpufreq/scaling_governor)
> -               sh -c "echo userspace > $x/cpufreq/scaling_governor" >/dev/null 2>&1
> +       done
> +       for x in $(ls -1) ; do
> +               [ -d $x/cpufreq ] || continue
> +               [ -f $x/cpufreq/scaling_governor ] || continue
> +
> +               gov="$TEMPORARY_CPUFREQ_GOVERNOR"
> +               grep -q "$GOVERNOR" $x/cpufreq/scaling_available_governors \
> +                       || gov="userspace"
> +               sh -c "echo \"$gov\" > $x/cpufreq/scaling_governor"

What is the thing with this "sh -c echo ...", why don't we simply do
"echo $gov > $x/...".

If this is a cool trick, i don't know it yet :-)
-- 
Stefan Seyfried

"Any ideas, John?"
"Well, surrounding them's out." 


More information about the Pm-utils mailing list