aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/sched.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2009-02-26 07:02:23 -0500
committerIngo Molnar <mingo@elte.hu>2009-02-26 07:02:23 -0500
commit8e818179eb9e8f9e44d8410dd2a25077d026a08e (patch)
tree7d08afd30c95c04129c20693d974a18799caeb5a /kernel/sched.c
parent742bd95ba96e19b3f7196c3a0834ebc17c8ba006 (diff)
parentecc25fbd6b9e07b33895c61ddf84006b00f55d99 (diff)
Merge branch 'x86/core' into perfcounters/core
Conflicts: arch/x86/kernel/apic/apic.c arch/x86/kernel/irqinit_32.c Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/sched.c')
-rw-r--r--kernel/sched.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/kernel/sched.c b/kernel/sched.c
index 83b68ff6df80..16b73635f28f 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -7026,20 +7026,26 @@ static void free_rootdomain(struct root_domain *rd)
7026 7026
7027static void rq_attach_root(struct rq *rq, struct root_domain *rd) 7027static void rq_attach_root(struct rq *rq, struct root_domain *rd)
7028{ 7028{
7029 struct root_domain *old_rd = NULL;
7029 unsigned long flags; 7030 unsigned long flags;
7030 7031
7031 spin_lock_irqsave(&rq->lock, flags); 7032 spin_lock_irqsave(&rq->lock, flags);
7032 7033
7033 if (rq->rd) { 7034 if (rq->rd) {
7034 struct root_domain *old_rd = rq->rd; 7035 old_rd = rq->rd;
7035 7036
7036 if (cpumask_test_cpu(rq->cpu, old_rd->online)) 7037 if (cpumask_test_cpu(rq->cpu, old_rd->online))
7037 set_rq_offline(rq); 7038 set_rq_offline(rq);
7038 7039
7039 cpumask_clear_cpu(rq->cpu, old_rd->span); 7040 cpumask_clear_cpu(rq->cpu, old_rd->span);
7040 7041
7041 if (atomic_dec_and_test(&old_rd->refcount)) 7042 /*
7042 free_rootdomain(old_rd); 7043 * If we dont want to free the old_rt yet then
7044 * set old_rd to NULL to skip the freeing later
7045 * in this function:
7046 */
7047 if (!atomic_dec_and_test(&old_rd->refcount))
7048 old_rd = NULL;
7043 } 7049 }
7044 7050
7045 atomic_inc(&rd->refcount); 7051 atomic_inc(&rd->refcount);
@@ -7050,6 +7056,9 @@ static void rq_attach_root(struct rq *rq, struct root_domain *rd)
7050 set_rq_online(rq); 7056 set_rq_online(rq);
7051 7057
7052 spin_unlock_irqrestore(&rq->lock, flags); 7058 spin_unlock_irqrestore(&rq->lock, flags);
7059
7060 if (old_rd)
7061 free_rootdomain(old_rd);
7053} 7062}
7054 7063
7055static int __init_refok init_rootdomain(struct root_domain *rd, bool bootmem) 7064static int __init_refok init_rootdomain(struct root_domain *rd, bool bootmem)