cpusets: add functions and code for initialization
PATCH 2/5 cpusets: add functions and code for initialization
From: Michael Wang <[email protected]>
Add the functions and code which will do initialization for dynamical domain flags.
Signed-off-by Michael Wang <[email protected]>
--- include/linux/sched.h | 10 ++++++++-- kernel/cpuset.c | 8 ++++++-- kernel/sched/core.c | 2 +- 3 files changed, 15 insertions(+), 5 deletions(-)
include/linux/sched.h +8 -2
@@ -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 {
kernel/cpuset.c +6 -2
@@ -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++;
kernel/sched/core.c +1 -1
@@ -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 ));
Signature · 1 line
1.7.4.1