summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2002-07-23 20:04:01 -0700
committerIngo Molnar <mingo@elte.hu>2002-07-23 20:04:01 -0700
commita6efb709806ceffb0331c22328267d7f327c6518 (patch)
treed7b8229a573e88b8b7eefa4bcb10f057917f2b31 /include/linux
parent1da3174ffe3d0f29d21209a74e510723c9655031 (diff)
[PATCH] irqlock patch 2.5.27-H6
- init thread needs to have preempt_count of 1 until sched_init(). (William Lee Irwin III) - clean up the irq-mask macros. (Linus) - add barrier() to irq_enter() and irq_exit(). (based on Oleg Nesterov's comment.) - move the irqs-off check into preempt_schedule() and remove CONFIG_DEBUG_IRQ_SCHEDULE. - remove spin_unlock_no_resched() and comment the affected places more agressively. - slab.c needs to spin_unlock_no_resched(), instead of spin_unlock(). (It also has to check for preemption in the right spot.) This should fix the memory corruption. - irq_exit() needs to run softirqs if interrupts not active - in the previous patch it ran them when preempt_count() was 0, which is incorrect. - spinlock macros are updated to enable preemption after enabling interrupts. Besides avoiding false positive warnings, this also - fork.c has to call scheduler_tick() with preemption disabled - otherwise scheduler_tick()'s spin_unlock can preempt! - irqs_disabled() macro introduced. - [ all other local_irq_enable() or sti instances conditional on CONFIG_DEBUG_IRQ_SCHEDULE are to fix false positive warnings. ] - fix buggy in_softirq(). Fortunately the bug made the test broader, which didnt result in algorithmical breakage, just suboptimal performance. - move do_softirq() processing into irq_exit() => this also fixes the softirq processing bugs present in apic.c IRQ handlers that did not test for softirqs after irq_exit(). - simplify local_bh_enable().
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/spinlock.h21
1 files changed, 7 insertions, 14 deletions
diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h
index d9f4af4103e4..749d3054b2dc 100644
--- a/include/linux/spinlock.h
+++ b/include/linux/spinlock.h
@@ -26,17 +26,17 @@
#define write_lock_irq(lock) do { local_irq_disable(); write_lock(lock); } while (0)
#define write_lock_bh(lock) do { local_bh_disable(); write_lock(lock); } while (0)
-#define spin_unlock_irqrestore(lock, flags) do { spin_unlock(lock); local_irq_restore(flags); } while (0)
+#define spin_unlock_irqrestore(lock, flags) do { _raw_spin_unlock(lock); local_irq_restore(flags); preempt_enable(); } while (0)
#define _raw_spin_unlock_irqrestore(lock, flags) do { _raw_spin_unlock(lock); local_irq_restore(flags); } while (0)
-#define spin_unlock_irq(lock) do { spin_unlock(lock); local_irq_enable(); } while (0)
-#define spin_unlock_bh(lock) do { spin_unlock(lock); local_bh_enable(); } while (0)
+#define spin_unlock_irq(lock) do { _raw_spin_unlock(lock); local_irq_enable(); preempt_enable(); } while (0)
+#define spin_unlock_bh(lock) do { spin_unlock(lock); local_bh_enable(); } while (0)
-#define read_unlock_irqrestore(lock, flags) do { read_unlock(lock); local_irq_restore(flags); } while (0)
-#define read_unlock_irq(lock) do { read_unlock(lock); local_irq_enable(); } while (0)
+#define read_unlock_irqrestore(lock, flags) do { _raw_read_unlock(lock); local_irq_restore(flags); preempt_enable(); } while (0)
+#define read_unlock_irq(lock) do { _raw_read_unlock(lock); local_irq_enable(); preempt_enable(); } while (0)
#define read_unlock_bh(lock) do { read_unlock(lock); local_bh_enable(); } while (0)
-#define write_unlock_irqrestore(lock, flags) do { write_unlock(lock); local_irq_restore(flags); } while (0)
-#define write_unlock_irq(lock) do { write_unlock(lock); local_irq_enable(); } while (0)
+#define write_unlock_irqrestore(lock, flags) do { _raw_write_unlock(lock); local_irq_restore(flags); preempt_enable(); } while (0)
+#define write_unlock_irq(lock) do { _raw_write_unlock(lock); local_irq_enable(); preempt_enable(); } while (0)
#define write_unlock_bh(lock) do { write_unlock(lock); local_bh_enable(); } while (0)
#define spin_trylock_bh(lock) ({ int __r; local_bh_disable();\
__r = spin_trylock(lock); \
@@ -135,12 +135,6 @@ do { \
preempt_enable(); \
} while (0)
-#define spin_unlock_no_resched(lock) \
-do { \
- _raw_spin_unlock(lock); \
- preempt_enable_no_resched(); \
-} while (0)
-
#define read_lock(lock) ({preempt_disable(); _raw_read_lock(lock);})
#define read_unlock(lock) ({_raw_read_unlock(lock); preempt_enable();})
#define write_lock(lock) ({preempt_disable(); _raw_write_lock(lock);})
@@ -153,7 +147,6 @@ do { \
#define spin_lock(lock) _raw_spin_lock(lock)
#define spin_trylock(lock) _raw_spin_trylock(lock)
#define spin_unlock(lock) _raw_spin_unlock(lock)
-#define spin_unlock_no_resched(lock) _raw_spin_unlock(lock)
#define read_lock(lock) _raw_read_lock(lock)
#define read_unlock(lock) _raw_read_unlock(lock)