diff options
author | Linus Torvalds | 2009-02-17 23:30:06 +0100 |
---|---|---|
committer | Linus Torvalds | 2009-02-17 23:30:06 +0100 |
commit | e78ac4b9deb8f36d8c828b6d91232960f109d951 (patch) | |
tree | 09d0eb38a666071bc90a8637cd0501ecc152cda0 /kernel | |
parent | Merge branch 'timers-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/k... (diff) | |
parent | sched: cpu hotplug fix (diff) | |
download | kernel-qcow2-linux-e78ac4b9deb8f36d8c828b6d91232960f109d951.tar.gz kernel-qcow2-linux-e78ac4b9deb8f36d8c828b6d91232960f109d951.tar.xz kernel-qcow2-linux-e78ac4b9deb8f36d8c828b6d91232960f109d951.zip |
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
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/sched.c | 15 |
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) static void rq_attach_root(struct rq *rq, struct root_domain *rd) { + struct root_domain *old_rd = NULL; unsigned long flags; spin_lock_irqsave(&rq->lock, flags); if (rq->rd) { - struct root_domain *old_rd = rq->rd; + old_rd = rq->rd; if (cpumask_test_cpu(rq->cpu, old_rd->online)) set_rq_offline(rq); cpumask_clear_cpu(rq->cpu, old_rd->span); - if (atomic_dec_and_test(&old_rd->refcount)) - free_rootdomain(old_rd); + /* + * If we dont want to free the old_rt yet then + * set old_rd to NULL to skip the freeing later + * in this function: + */ + if (!atomic_dec_and_test(&old_rd->refcount)) + old_rd = NULL; } atomic_inc(&rd->refcount); @@ -6968,6 +6974,9 @@ static void rq_attach_root(struct rq *rq, struct root_domain *rd) set_rq_online(rq); spin_unlock_irqrestore(&rq->lock, flags); + + if (old_rd) + free_rootdomain(old_rd); } static int __init_refok init_rootdomain(struct root_domain *rd, bool bootmem) |