[PATCH/RFC 2/5] [PATCH] sched: pass sched_domain_level to sched_power_savings_store

From: Heiko Carstens
Date: Thu Aug 12 2010 - 13:25:40 EST


From: Heiko Carstens <heiko.carstens@xxxxxxxxxx>

Pass the corresponding sched domain level to sched_power_savings_store instead
of a yes/no flag which indicates if the level is SMT or MC.
This is needed to easily extend the function so it can be used for a third
level.

Signed-off-by: Heiko Carstens <heiko.carstens@xxxxxxxxxx>
---

kernel/sched.c | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)

diff -urpN linux-2.6/kernel/sched.c linux-2.6-patched/kernel/sched.c
--- linux-2.6/kernel/sched.c 2010-08-11 13:47:22.000000000 +0200
+++ linux-2.6-patched/kernel/sched.c 2010-08-11 13:47:22.000000000 +0200
@@ -7380,7 +7380,8 @@ static void arch_reinit_sched_domains(vo
put_online_cpus();
}

-static ssize_t sched_power_savings_store(const char *buf, size_t count, int smt)
+static ssize_t sched_power_savings_store(const char *buf, size_t count,
+ enum sched_domain_level sd_level)
{
unsigned int level = 0;

@@ -7397,10 +7398,16 @@ static ssize_t sched_power_savings_store
if (level >= MAX_POWERSAVINGS_BALANCE_LEVELS)
return -EINVAL;

- if (smt)
+ switch (sd_level) {
+ case SD_LV_SIBLING:
sched_smt_power_savings = level;
- else
+ break;
+ case SD_LV_MC:
sched_mc_power_savings = level;
+ break;
+ default:
+ break;
+ }

arch_reinit_sched_domains();

@@ -7418,7 +7425,7 @@ static ssize_t sched_mc_power_savings_st
struct sysdev_class_attribute *attr,
const char *buf, size_t count)
{
- return sched_power_savings_store(buf, count, 0);
+ return sched_power_savings_store(buf, count, SD_LV_MC);
}
static SYSDEV_CLASS_ATTR(sched_mc_power_savings, 0644,
sched_mc_power_savings_show,
@@ -7436,7 +7443,7 @@ static ssize_t sched_smt_power_savings_s
struct sysdev_class_attribute *attr,
const char *buf, size_t count)
{
- return sched_power_savings_store(buf, count, 1);
+ return sched_power_savings_store(buf, count, SD_LV_SIBLING);
}
static SYSDEV_CLASS_ATTR(sched_smt_power_savings, 0644,
sched_smt_power_savings_show,

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/