lkml.org 
[lkml]   [2009]   [Feb]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[patch] sched: cpu hotplug fix

    The fix below addresses a lockdep warning i triggered with your config.

    (You could hit this if you try to use s2ram or hibernation or explicit
    CPU hotplug ops.)

    Ingo

    -------------->
    Subject: sched: cpu hotplug fix
    From: Ingo Molnar <mingo@elte.hu>
    Date: Thu Feb 12 11:35:40 CET 2009

    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>
    ---
    kernel/sched.c | 15 ++++++++++++---
    1 file changed, 12 insertions(+), 3 deletions(-)

    Index: tip/kernel/sched.c
    ===================================================================
    --- tip.orig/kernel/sched.c
    +++ tip/kernel/sched.c
    @@ -7619,20 +7619,26 @@ static void free_rootdomain(struct root_

    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);
    @@ -7643,6 +7649,9 @@ static void rq_attach_root(struct rq *rq
    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)


    \
     
     \ /
      Last update: 2009-02-12 11:53    [W:0.023 / U:0.804 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site