VisionFive2 Linux kernel

StarFive Tech Linux Kernel for VisionFive (JH7110) boards (mirror)

More than 9999 Commits   33 Branches   55 Tags
author: Gautham R Shenoy <ego@in.ibm.com> 2007-10-18 23:40:47 -0700 committer: Linus Torvalds <torvalds@woody.linux-foundation.org> 2007-10-19 11:53:44 -0700 commit: d2b20b11547cefc89d6c81937e81afaf3c62808b parent: 73e753a50dcac7d6d4fa8b9552203ef544a70d77
Commit Summary:
Add irq protection in the percpu-counters cpu-hotplug-callback path
Diffstat:
1 file changed, 3 insertions, 2 deletions
diff --git a/lib/percpu_counter.c b/lib/percpu_counter.c
index 9659eabffc31..393a0e915c23 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,
 	mutex_lock(&percpu_counters_lock);
 	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);
 	}
 	mutex_unlock(&percpu_counters_lock);
 	return NOTIFY_OK;