[CPUFREQ] Introduce /sys/devices/system/cpu/cpu*/cpufreq/cpuinfo_transition_latency
authorThomas Renninger <trenn@suse.de>
Wed, 4 Feb 2009 00:17:41 +0000 (01:17 +0100)
committerDave Jones <davej@redhat.com>
Wed, 25 Feb 2009 03:47:31 +0000 (22:47 -0500)
It's not only useful for the ondemand and conservative governors, but
also for userspace daemons to know about the HW transition latency of
the CPU.
It is especially useful for userspace to know about this value when
the ondemand or conservative governors are run. The sampling rate
control value depends on it and for userspace being able to set sane
tuning values there it has to know about the transition latency.

Signed-off-by: Thomas Renninger <trenn@suse.de>
Signed-off-by: Dave Jones <davej@redhat.com>
Documentation/cpu-freq/user-guide.txt
drivers/cpufreq/cpufreq.c

index 917918f84fc75ac09061be1f1f242159823983cf..75f41193f3e1858b2370a2f4500caf49d2b90360 100644 (file)
@@ -152,6 +152,18 @@ cpuinfo_min_freq :         this file shows the minimum operating
                                frequency the processor can run at(in kHz) 
 cpuinfo_max_freq :             this file shows the maximum operating
                                frequency the processor can run at(in kHz) 
+cpuinfo_transition_latency     The time it takes on this CPU to
+                               switch between two frequencies in nano
+                               seconds. If unknown or known to be
+                               that high that the driver does not
+                               work with the ondemand governor, -1
+                               (CPUFREQ_ETERNAL) will be returned.
+                               Using this information can be useful
+                               to choose an appropriate polling
+                               frequency for a kernel governor or
+                               userspace daemon. Make sure to not
+                               switch the frequency too often
+                               resulting in performance loss.
 scaling_driver :               this file shows what cpufreq driver is
                                used to set the frequency on this CPU
 
index 1867dac35aff831273cac8fa7f509db239c4657c..6fe466efb0b590aaf395bcfd339bd7962bf65a07 100644 (file)
@@ -452,6 +452,7 @@ static ssize_t show_##file_name                             \
 
 show_one(cpuinfo_min_freq, cpuinfo.min_freq);
 show_one(cpuinfo_max_freq, cpuinfo.max_freq);
+show_one(cpuinfo_transition_latency, cpuinfo.transition_latency);
 show_one(scaling_min_freq, min);
 show_one(scaling_max_freq, max);
 show_one(scaling_cur_freq, cur);
@@ -659,6 +660,7 @@ __ATTR(_name, 0644, show_##_name, store_##_name)
 define_one_ro0400(cpuinfo_cur_freq);
 define_one_ro(cpuinfo_min_freq);
 define_one_ro(cpuinfo_max_freq);
+define_one_ro(cpuinfo_transition_latency);
 define_one_ro(scaling_available_governors);
 define_one_ro(scaling_driver);
 define_one_ro(scaling_cur_freq);
@@ -672,6 +674,7 @@ define_one_rw(scaling_setspeed);
 static struct attribute *default_attrs[] = {
        &cpuinfo_min_freq.attr,
        &cpuinfo_max_freq.attr,
+       &cpuinfo_transition_latency.attr,
        &scaling_min_freq.attr,
        &scaling_max_freq.attr,
        &affected_cpus.attr,