mirror of
https://github.com/adulau/aha.git
synced 2024-12-28 19:56:18 +00:00
sched: cpu hotplug fix
rq_attach_root() does a kfree() with the runqueue lock held. That's not a very wise move, fix it. Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
parent
b578f3fcca
commit
a0490fa35d
1 changed files with 12 additions and 3 deletions
|
@ -6944,20 +6944,26 @@ static void free_rootdomain(struct root_domain *rd)
|
||||||
|
|
||||||
static void rq_attach_root(struct rq *rq, 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;
|
unsigned long flags;
|
||||||
|
|
||||||
spin_lock_irqsave(&rq->lock, flags);
|
spin_lock_irqsave(&rq->lock, flags);
|
||||||
|
|
||||||
if (rq->rd) {
|
if (rq->rd) {
|
||||||
struct root_domain *old_rd = rq->rd;
|
old_rd = rq->rd;
|
||||||
|
|
||||||
if (cpumask_test_cpu(rq->cpu, old_rd->online))
|
if (cpumask_test_cpu(rq->cpu, old_rd->online))
|
||||||
set_rq_offline(rq);
|
set_rq_offline(rq);
|
||||||
|
|
||||||
cpumask_clear_cpu(rq->cpu, old_rd->span);
|
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);
|
atomic_inc(&rd->refcount);
|
||||||
|
@ -6968,6 +6974,9 @@ static void rq_attach_root(struct rq *rq, struct root_domain *rd)
|
||||||
set_rq_online(rq);
|
set_rq_online(rq);
|
||||||
|
|
||||||
spin_unlock_irqrestore(&rq->lock, flags);
|
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)
|
static int __init_refok init_rootdomain(struct root_domain *rd, bool bootmem)
|
||||||
|
|
Loading…
Reference in a new issue