Skip to content

Commit

Permalink
cpupower: Do not change the frequency of offline cpu
Browse files Browse the repository at this point in the history
Check if the cpu is online before changing the frequency/governor of
the cpu.

Reported-by: Pavaman Subramaniyam <pavsubra@linux.vnet.ibm.com>
Signed-off-by: Shilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com>
Reviewed-by: Gautham R. Shenoy <ego@linux.vnet.ibm.com>
Acked-by: Thomas Renninger <trenn@suse.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
  • Loading branch information
Shilpasri G Bhat authored and Rafael J. Wysocki committed Jul 23, 2015
1 parent 52721d9 commit 2e5e8fd
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tools/power/cpupower/utils/cpufreq-set.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

#include "cpufreq.h"
#include "helpers/helpers.h"
#include "helpers/sysfs.h"

#define NORM_FREQ_LEN 32

Expand Down Expand Up @@ -318,6 +319,9 @@ int cmd_freq_set(int argc, char **argv)
cpufreq_cpu_exists(cpu))
continue;

if (sysfs_is_cpu_online(cpu) != 1)
continue;

printf(_("Setting cpu: %d\n"), cpu);
ret = do_one_cpu(cpu, &new_pol, freq, policychange);
if (ret) {
Expand Down

0 comments on commit 2e5e8fd

Please sign in to comment.