public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/5] cpusets: add functions and code for initialization
@ 2012-07-17  9:04 Michael Wang
  0 siblings, 0 replies; only message in thread
From: Michael Wang @ 2012-07-17  9:04 UTC (permalink / raw)
  To: LKML; +Cc: mingo, Peter Zijlstra, paul

From: Michael Wang <wangyun@linux.vnet.ibm.com>

Add the functions and code which will do initialization for dynamical
domain flags.

Signed-off-by: Michael Wang <wangyun@linux.vnet.ibm.com>
---
 include/linux/sched.h |   10 ++++++++--
 kernel/cpuset.c       |    8 ++++++--
 kernel/sched/core.c   |    2 +-
 3 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/include/linux/sched.h b/include/linux/sched.h
index 9164309..3c91116 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -948,10 +948,16 @@ struct sched_domain_attr {
 	int enable_ddf;
 };
 
-#define SD_ATTR_INIT	(struct sched_domain_attr) {	\
-	.relax_domain_level = -1,			\
+static inline void sd_attr_init(struct sched_domain_attr *attr)
+{
+	int i;
+	attr->relax_domain_level = -1;
+	for (i = 0; i < MAX_DDF; i++)
+		attr->ddf[i] = 0;
+	attr->enable_ddf = 0;
 }
 
+
 extern int sched_domain_level_max;
 
 struct sched_domain {
diff --git a/kernel/cpuset.c b/kernel/cpuset.c
index 35fb585..67ee111 100644
--- a/kernel/cpuset.c
+++ b/kernel/cpuset.c
@@ -588,7 +588,7 @@ static int generate_sched_domains(cpumask_var_t **domains,
 
 		dattr = kmalloc(sizeof(struct sched_domain_attr), GFP_KERNEL);
 		if (dattr) {
-			*dattr = SD_ATTR_INIT;
+			sd_attr_init(dattr);
 			update_domain_attr_tree(dattr, &top_cpuset);
 		}
 		cpumask_copy(doms[0], top_cpuset.cpus_allowed);
@@ -697,7 +697,7 @@ restart:
 
 		cpumask_clear(dp);
 		if (dattr)
-			*(dattr + nslot) = SD_ATTR_INIT;
+			sd_attr_init(dattr + nslot);
 		for (j = i; j < csn; j++) {
 			struct cpuset *b = csa[j];
 
@@ -1834,6 +1834,7 @@ static void cpuset_post_clone(struct cgroup *cgroup)
 
 static struct cgroup_subsys_state *cpuset_create(struct cgroup *cont)
 {
+	int i;
 	struct cpuset *cs;
 	struct cpuset *parent;
 
@@ -1859,6 +1860,9 @@ static struct cgroup_subsys_state *cpuset_create(struct cgroup *cont)
 	nodes_clear(cs->mems_allowed);
 	fmeter_init(&cs->fmeter);
 	cs->relax_domain_level = -1;
+	for (i = 0; i < MAX_DDF; i++)
+		cs->ddf[i] = 0;
+	cs->enable_ddf = 0;
 
 	cs->parent = parent;
 	number_of_cpusets++;
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 3987b9d..3f9d368 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -7087,7 +7087,7 @@ static int dattrs_equal(struct sched_domain_attr *cur, int idx_cur,
 	if (!new && !cur)
 		return 1;
 
-	tmp = SD_ATTR_INIT;
+	sd_attr_init(&tmp);
 	return !memcmp(cur ? (cur + idx_cur) : &tmp,
 			new ? (new + idx_new) : &tmp,
 			sizeof(struct sched_domain_attr));
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2012-07-17  9:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-17  9:04 [PATCH 2/5] cpusets: add functions and code for initialization Michael Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox