[Pm-utils] fix cpufreq governor setting on dualcore machines
Peter Jones
pjones at redhat.com
Wed Mar 14 08:36:41 PDT 2007
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.
Applied as:
Index: ChangeLog
===================================================================
RCS file: /cvs/pm-utils/pm-utils/ChangeLog,v
retrieving revision 1.70
diff -u -p -r1.70 ChangeLog
--- ChangeLog 14 Mar 2007 15:25:24 -0000 1.70
+++ ChangeLog 14 Mar 2007 15:32:10 -0000
@@ -1,6 +1,18 @@
2007-03-14 Peter Jones <pjones at redhat.com>
* pm/defaults:
+ - alphabetize
+
+ * pm/functions:
+ - add TEMPORARY_CPUFREQ_GOVERNOR and a default for it.
+
+ * pm/hooks/94cpufreq:
+ - don't change any cpu's governor until we've saved them
+ all (based on a patch from Frank Seidel via Stefan)
+
+2007-03-14 Peter Jones <pjones at redhat.com>
+
+ * pm/defaults:
- add comment text (from Stefan)
- remove default "button" removal, it's no longer needed (from Stefan)
cvs diff: Diffing man
cvs diff: Diffing pm
Index: pm/defaults
===================================================================
RCS file: /cvs/pm-utils/pm-utils/pm/defaults,v
retrieving revision 1.3
diff -u -p -r1.3 defaults
--- pm/defaults 14 Mar 2007 15:07:11 -0000 1.3
+++ pm/defaults 14 Mar 2007 15:32:10 -0000
@@ -3,6 +3,7 @@
# DO NOT EDIT THIS FILE, edit /etc/pm/config.d/ instead! #
##########################################################
+HIBERNATE_RESUME_POST_VIDEO="no"
+
SUSPEND_MODULES=""
-HIBERNATE_RESUME_POST_VIDEO="no"
Index: pm/functions
===================================================================
RCS file: /cvs/pm-utils/pm-utils/pm/functions,v
retrieving revision 1.38
diff -u -p -r1.38 functions
--- pm/functions 14 Mar 2007 15:25:24 -0000 1.38
+++ pm/functions 14 Mar 2007 15:32:10 -0000
@@ -12,6 +12,7 @@ HIBERNATE_RESUME_POST_VIDEO=no
INHIBIT=/var/run/pm-utils.inhibit
PM_LOGFILE=${PM_LOGFILE:=/var/log/pm-suspend.log}
SUSPEND_MODULES=""
+TEMPORARY_CPUFREQ_GOVERNOR="userspace"
[ -f /usr/lib/pm-utils/defaults ] && . /usr/lib/pm-utils/defaults
@@ -28,6 +29,7 @@ add_global PM_LOGFILE
add_global PM_CMDLINE
add_global RESUME_MODULES
add_global SUSPEND_MODULES
+add_global TEMPORARY_CPUFREQ_GOVERNOR
source_configs()
{
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"
done
popd >/dev/null 2>&1
}
@@ -23,7 +31,7 @@ thaw_cpufreq()
gov=$(restorestate $(echo cpu${x}_governor))
[ -z "$gov" ] && break
- sh -c "echo \"$gov\" > /sys/devices/system/cpu/cpu$x/cpufreq/scaling_governor" >/dev/null 2>&1
+ sh -c "echo \"$gov\" > /sys/devices/system/cpu/cpu$x/cpufreq/scaling_governor"
unset gov
x=$(($x + 1))
done
--
Peter
More information about the Pm-utils
mailing list