aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/cpuset.c
diff options
context:
space:
mode:
authorLi Zefan <lizf@cn.fujitsu.com>2008-07-25 04:47:23 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-25 13:53:38 -0400
commitc372e817afc629fea9ff6321313325ed0b4a855b (patch)
tree931188486a41a7923e4eb9b658a272b256b3c048 /kernel/cpuset.c
parentf9b4fb8dabf38fb456c97f01aace07cb6e7c1723 (diff)
cpuset: avoid unnecessary sched domains rebuilding
When changing 'sched_relax_domain_level', don't rebuild sched domains if 'cpus' is empty or 'sched_load_balance' is not set. Also make the comments of rebuild_sched_domains() more readable. Signed-off-by: Li Zefan <lizf@cn.fujitsu.com> Cc: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com> Cc: Paul Jackson <pj@sgi.com> Cc: Paul Menage <menage@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/cpuset.c')
-rw-r--r--kernel/cpuset.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/kernel/cpuset.c b/kernel/cpuset.c
index 6eae6639e851..60d2c4702c6c 100644
--- a/kernel/cpuset.c
+++ b/kernel/cpuset.c
@@ -496,11 +496,16 @@ update_domain_attr(struct sched_domain_attr *dattr, struct cpuset *c)
496/* 496/*
497 * rebuild_sched_domains() 497 * rebuild_sched_domains()
498 * 498 *
499 * If the flag 'sched_load_balance' of any cpuset with non-empty 499 * This routine will be called to rebuild the scheduler's dynamic
500 * 'cpus' changes, or if the 'cpus' allowed changes in any cpuset 500 * sched domains:
501 * which has that flag enabled, or if any cpuset with a non-empty 501 * - if the flag 'sched_load_balance' of any cpuset with non-empty
502 * 'cpus' is removed, then call this routine to rebuild the 502 * 'cpus' changes,
503 * scheduler's dynamic sched domains. 503 * - or if the 'cpus' allowed changes in any cpuset which has that
504 * flag enabled,
505 * - or if the 'sched_relax_domain_level' of any cpuset which has
506 * that flag enabled and with non-empty 'cpus' changes,
507 * - or if any cpuset with non-empty 'cpus' is removed,
508 * - or if a cpu gets offlined.
504 * 509 *
505 * This routine builds a partial partition of the systems CPUs 510 * This routine builds a partial partition of the systems CPUs
506 * (the set of non-overlappping cpumask_t's in the array 'part' 511 * (the set of non-overlappping cpumask_t's in the array 'part'
@@ -1076,7 +1081,8 @@ static int update_relax_domain_level(struct cpuset *cs, s64 val)
1076 1081
1077 if (val != cs->relax_domain_level) { 1082 if (val != cs->relax_domain_level) {
1078 cs->relax_domain_level = val; 1083 cs->relax_domain_level = val;
1079 rebuild_sched_domains(); 1084 if (!cpus_empty(cs->cpus_allowed) && is_sched_load_balance(cs))
1085 rebuild_sched_domains();
1080 } 1086 }
1081 1087
1082 return 0; 1088 return 0;