All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Wang <wangyun@linux.vnet.ibm.com>
To: LKML <linux-kernel@vger.kernel.org>
Cc: mingo@redhat.com, Peter Zijlstra <peterz@infradead.org>,
	paul@paulmenage.org
Subject: [PATCH 2/5] cpusets: add functions and code for initialization
Date: Tue, 17 Jul 2012 17:04:01 +0800	[thread overview]
Message-ID: <50052A81.1000600@linux.vnet.ibm.com> (raw)

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


                 reply	other threads:[~2012-07-17  9:04 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50052A81.1000600@linux.vnet.ibm.com \
    --to=wangyun@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=paul@paulmenage.org \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.