arm64: use private ratelimit state along with show_unhandled_signals
[sfrench/cifs-2.6.git] / arch / arm64 / include / asm / system_misc.h
index 659fbf5925de23f360affcaabbd1fe19aa8dc2a4..57f110bea6a82897520d435da21a920960fb7a2b 100644 (file)
@@ -23,6 +23,8 @@
 #include <linux/compiler.h>
 #include <linux/linkage.h>
 #include <linux/irqflags.h>
+#include <linux/signal.h>
+#include <linux/ratelimit.h>
 #include <linux/reboot.h>
 
 struct pt_regs;
@@ -43,6 +45,17 @@ extern void __show_regs(struct pt_regs *);
 
 extern void (*arm_pm_restart)(enum reboot_mode reboot_mode, const char *cmd);
 
+#define show_unhandled_signals_ratelimited()                           \
+({                                                                     \
+       static DEFINE_RATELIMIT_STATE(_rs,                              \
+                                     DEFAULT_RATELIMIT_INTERVAL,       \
+                                     DEFAULT_RATELIMIT_BURST);         \
+       bool __show_ratelimited = false;                                \
+       if (show_unhandled_signals && __ratelimit(&_rs))                \
+               __show_ratelimited = true;                              \
+       __show_ratelimited;                                             \
+})
+
 #define UDBG_UNDEFINED (1 << 0)
 #define UDBG_SYSCALL   (1 << 1)
 #define UDBG_BADABORT  (1 << 2)