aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-02-17 17:30:06 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-02-17 17:30:06 -0500
commite78ac4b9deb8f36d8c828b6d91232960f109d951 (patch)
tree09d0eb38a666071bc90a8637cd0501ecc152cda0
parent29a0c5ce5d008f398346d644456d62ab300d5e10 (diff)
parenta0490fa35dc0022ef95f64802e8edf18c411c790 (diff)
Merge branch 'sched-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'sched-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: sched: cpu hotplug fix
-rw-r--r--kernel/sched.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/kernel/sched.c b/kernel/sched.c
index c1d0ed360088..410eec404133 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -6944,20 +6944,26 @@ static void free_rootdomain(struct root_domain *rd)
6944 6944
6945static void rq_attach_root(struct rq *rq, struct root_domain *rd) 6945static void rq_attach_root(struct rq *rq, struct root_domain *rd)
6946{ 6946{
6947 struct root_domain *old_rd = NULL;
6947 unsigned long flags; 6948 unsigned long flags;
6948 6949
6949 spin_lock_irqsave(&rq->lock, flags); 6950 spin_lock_irqsave(&rq->lock, flags);
6950 6951
6951 if (rq->rd) { 6952 if (rq->rd) {
6952 struct root_domain *old_rd = rq->rd; 6953 old_rd = rq->rd;
6953 6954
6954 if (cpumask_test_cpu(rq->cpu, old_rd->online)) 6955 if (cpumask_test_cpu(rq->cpu, old_rd->online))
6955 set_rq_offline(rq); 6956 set_rq_offline(rq);
6956 6957
6957 cpumask_clear_cpu(rq->cpu, old_rd->span); 6958 cpumask_clear_cpu(rq->cpu, old_rd->span);
6958 6959
6959 if (atomic_dec_and_test(&old_rd->refcount)) 6960 /*
6960 free_rootdomain(old_rd); 6961 * If we dont want to free the old_rt yet then
6962 * set old_rd to NULL to skip the freeing later
6963 * in this function:
6964 */
6965 if (!atomic_dec_and_test(&old_rd->refcount))
6966 old_rd = NULL;
6961 } 6967 }
6962 6968
6963 atomic_inc(&rd->refcount); 6969 atomic_inc(&rd->refcount);
@@ -6968,6 +6974,9 @@ static void rq_attach_root(struct rq *rq, struct root_domain *rd)
6968 set_rq_online(rq); 6974 set_rq_online(rq);
6969 6975
6970 spin_unlock_irqrestore(&rq->lock, flags); 6976 spin_unlock_irqrestore(&rq->lock, flags);
6977
6978 if (old_rd)
6979 free_rootdomain(old_rd);
6971} 6980}
6972 6981
6973static int __init_refok init_rootdomain(struct root_domain *rd, bool bootmem) 6982static int __init_refok init_rootdomain(struct root_domain *rd, bool bootmem)