Commit:     d2b20b11547cefc89d6c81937e81afaf3c62808b
Parent:     73e753a50dcac7d6d4fa8b9552203ef544a70d77
Author:     Gautham R Shenoy <[EMAIL PROTECTED]>
AuthorDate: Thu Oct 18 23:40:47 2007 -0700
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Fri Oct 19 11:53:44 2007 -0700

    Add irq protection in the percpu-counters cpu-hotplug-callback path
    Some of the per-cpu counters and thus their locks are accessed from IRQ
    contexts.  This can cause a deadlock if it interrupts a cpu-offline thread
    which is transferring a dead-cpu's counts to the global counter.
    Add appropriate IRQ protection in the cpu-hotplug callback path.
    Signed-off-by: Gautham R Shenoy <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
 lib/percpu_counter.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/percpu_counter.c b/lib/percpu_counter.c
index 9659eab..393a0e9 100644
--- a/lib/percpu_counter.c
+++ b/lib/percpu_counter.c
@@ -124,12 +124,13 @@ static int __cpuinit 
percpu_counter_hotcpu_callback(struct notifier_block *nb,
        list_for_each_entry(fbc, &percpu_counters, list) {
                s32 *pcount;
+               unsigned long flags;
-               spin_lock(&fbc->lock);
+               spin_lock_irqsave(&fbc->lock, flags);
                pcount = per_cpu_ptr(fbc->counters, cpu);
                fbc->count += *pcount;
                *pcount = 0;
-               spin_unlock(&fbc->lock);
+               spin_unlock_irqrestore(&fbc->lock, flags);
        return NOTIFY_OK;
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at

Reply via email to