Skip to contentSkip to conversation

cpusets: add fundamental functions for recording

PATCH In review Michael Wang 1 participant 1 message Jul 17, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 4/5 cpusets: add fundamental functions for recording

From: Michael Wang <[email protected]>

Add the fundamental functions which will help to record the status of dynamical domain flags for cpuset.

---
 kernel/cpuset.c |   31 +++++++++++++++++++++++++++++++
 1 files changed, 31 insertions(+), 0 deletions(-)
kernel/cpuset.c +31 -0
index def8080..066c61c 100644
@@ -1189,6 +1189,37 @@ static int update_relax_domain_level(struct cpuset *cs, s64 val)
 }
 
 /*
+ * update the ddf of cs according to level and rebuild domain
+ * if ddf enabled.
+ */
+static int update_ddf(int level, struct cpuset *cs, u64 val)
+{
+	if (!is_sched_load_balance(cs))
+		return -EINVAL;
+
+	cs->ddf[level] = val;
+	if (cs->enable_ddf)
+		async_rebuild_sched_domains();
+
+	return 0;
+}
+
+/* enable or disable ddf supporting and rebuild domain */
+static int enable_ddf(struct cpuset *cs, u64 val)
+{
+	if (!is_sched_load_balance(cs))
+		return -EINVAL;
+
+	if ((val != 0 && val != 1) || cs->enable_ddf == val)
+		return -EINVAL;
+
+	cs->enable_ddf = val;
+	async_rebuild_sched_domains();
+
+	return 0;
+}
+
+/*
  * cpuset_change_flag - make a task's spread flags the same as its cpuset's
  * @tsk: task to be updated
  * @scan: struct cgroup_scanner containing the cgroup of the task
Signature · 1 line
1.7.4.1