[PATCH 5/5] cpusets: add the configuration facility

From: Michael Wang
Date: Tue Jul 17 2012 - 05:04:35 EST


From: Michael Wang <wangyun@xxxxxxxxxxxxxxxxxx>

Add the facility for user to configure the dynamical domain flags and
enable/disable it.

Signed-off-by: Michael Wang <wangyun@xxxxxxxxxxxxxxxxxx>
---
kernel/cpuset.c | 85 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 85 insertions(+), 0 deletions(-)

diff --git a/kernel/cpuset.c b/kernel/cpuset.c
index 066c61c..5ff649d 100644
--- a/kernel/cpuset.c
+++ b/kernel/cpuset.c
@@ -1506,6 +1506,17 @@ typedef enum {
FILE_MEM_HARDWALL,
FILE_SCHED_LOAD_BALANCE,
FILE_SCHED_RELAX_DOMAIN_LEVEL,
+#ifdef CONFIG_SCHED_SMT
+ FILE_SCHED_SMT_DDF,
+#endif
+#ifdef CONFIG_SCHED_MC
+ FILE_SCHED_MC_DDF,
+#endif
+#ifdef CONFIG_SCHED_BOOK
+ FILE_SCHED_BOOK_DDF,
+#endif
+ FILE_SCHED_CPU_DDF,
+ FILE_SCHED_ENABLE_DDF,
FILE_MEMORY_PRESSURE_ENABLED,
FILE_MEMORY_PRESSURE,
FILE_SPREAD_PAGE,
@@ -1549,6 +1560,27 @@ static int cpuset_write_u64(struct cgroup *cgrp, struct cftype *cft, u64 val)
case FILE_SPREAD_SLAB:
retval = update_flag(CS_SPREAD_SLAB, cs, val);
break;
+#ifdef CONFIG_SCHED_SMT
+ case FILE_SCHED_SMT_DDF:
+ retval = update_ddf(SMT_DDF, cs, val);
+ break;
+#endif
+#ifdef CONFIG_SCHED_MC
+ case FILE_SCHED_MC_DDF:
+ retval = update_ddf(MC_DDF, cs, val);
+ break;
+#endif
+#ifdef CONFIG_SCHED_BOOK
+ case FILE_SCHED_BOOK_DDF:
+ retval = update_ddf(BOOK_DDF, cs, val);
+ break;
+#endif
+ case FILE_SCHED_CPU_DDF:
+ retval = update_ddf(CPU_DDF, cs, val);
+ break;
+ case FILE_SCHED_ENABLE_DDF:
+ retval = enable_ddf(cs, val);
+ break;
default:
retval = -EINVAL;
break;
@@ -1708,6 +1740,22 @@ static u64 cpuset_read_u64(struct cgroup *cont, struct cftype *cft)
return is_spread_page(cs);
case FILE_SPREAD_SLAB:
return is_spread_slab(cs);
+#ifdef CONFIG_SCHED_SMT
+ case FILE_SCHED_SMT_DDF:
+ return cs->ddf[SMT_DDF];
+#endif
+#ifdef CONFIG_SCHED_MC
+ case FILE_SCHED_MC_DDF:
+ return cs->ddf[MC_DDF];
+#endif
+#ifdef CONFIG_SCHED_BOOK
+ case FILE_SCHED_BOOK_DDF:
+ return cs->ddf[BOOK_DDF];
+#endif
+ case FILE_SCHED_CPU_DDF:
+ return cs->ddf[CPU_DDF];
+ case FILE_SCHED_ENABLE_DDF:
+ return cs->enable_ddf;
default:
BUG();
}
@@ -1788,6 +1836,43 @@ static struct cftype files[] = {
.private = FILE_SCHED_RELAX_DOMAIN_LEVEL,
},

+#ifdef CONFIG_SCHED_SMT
+ {
+ .name = "sched_smt_domain_flag",
+ .read_u64 = cpuset_read_u64,
+ .write_u64 = cpuset_write_u64,
+ .private = FILE_SCHED_SMT_DDF,
+ },
+#endif
+#ifdef CONFIG_SCHED_MC
+ {
+ .name = "sched_mc_domain_flag",
+ .read_u64 = cpuset_read_u64,
+ .write_u64 = cpuset_write_u64,
+ .private = FILE_SCHED_MC_DDF,
+ },
+#endif
+#ifdef CONFIG_SCHED_BOOK
+ {
+ .name = "sched_book_domain_flag",
+ .read_u64 = cpuset_read_u64,
+ .write_u64 = cpuset_write_u64,
+ .private = FILE_SCHED_BOOK_DDF,
+ },
+#endif
+ {
+ .name = "sched_cpu_domain_flag",
+ .read_u64 = cpuset_read_u64,
+ .write_u64 = cpuset_write_u64,
+ .private = FILE_SCHED_CPU_DDF,
+ },
+ {
+ .name = "sched_enable_domain_flag",
+ .read_u64 = cpuset_read_u64,
+ .write_u64 = cpuset_write_u64,
+ .private = FILE_SCHED_ENABLE_DDF,
+ },
+
{
.name = "memory_migrate",
.read_u64 = cpuset_read_u64,
--
1.7.4.1

--
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/