As we plan to narrow down local_bh_disable() to a per-vector disablement
granularity, a shortcut can be handy for code that want to disable all
of them and not care about carrying the bh enabled mask state prior to
the call.

(TODO: check that it is called while bh are ALL enabled because
local_bh_enable_all() is going to re-enable ALL of them. Pretty much like
there should be no local_irq_enable() between a pair or local_irq_save()
and local_irq_restore()).

Signed-off-by: Frederic Weisbecker <frede...@kernel.org>
Cc: Ingo Molnar <mi...@kernel.org>
Cc: Sebastian Andrzej Siewior <bige...@linutronix.de>
Cc: Thomas Gleixner <t...@linutronix.de>
Cc: Peter Zijlstra <pet...@infradead.org>
Cc: Linus Torvalds <torva...@linux-foundation.org>
Cc: David S. Miller <da...@davemloft.net>
Cc: Mauro Carvalho Chehab <mche...@s-opensource.com>
Cc: Paul E. McKenney <paul...@linux.vnet.ibm.com>
---
 include/linux/bottom_half.h |  3 +++
 kernel/softirq.c            | 10 ++++++++++
 2 files changed, 13 insertions(+)

diff --git a/include/linux/bottom_half.h b/include/linux/bottom_half.h
index fd75d1a..192a71c 100644
--- a/include/linux/bottom_half.h
+++ b/include/linux/bottom_half.h
@@ -64,4 +64,7 @@ static inline void local_bh_enable(void)
        __local_bh_enable_ip(_THIS_IP_, SOFTIRQ_DISABLE_OFFSET);
 }
 
+extern void local_bh_disable_all(void);
+extern void local_bh_enable_all(void);
+
 #endif /* _LINUX_BH_H */
diff --git a/kernel/softirq.c b/kernel/softirq.c
index 75aab25..730a5c9 100644
--- a/kernel/softirq.c
+++ b/kernel/softirq.c
@@ -197,6 +197,16 @@ void __local_bh_enable_ip(unsigned long ip, unsigned int 
cnt)
 }
 EXPORT_SYMBOL(__local_bh_enable_ip);
 
+void local_bh_disable_all(void)
+{
+       local_bh_disable();
+}
+
+void local_bh_enable_all(void)
+{
+       local_bh_enable();
+}
+
 /*
  * We restart softirq processing for at most MAX_SOFTIRQ_RESTART times,
  * but break the loop if need_resched() is set or after 2 ms.
-- 
2.7.4

Reply via email to