diff options
-rw-r--r-- | arch/x86/kernel/cpu/mcheck/mce_64.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/arch/x86/kernel/cpu/mcheck/mce_64.c b/arch/x86/kernel/cpu/mcheck/mce_64.c index 39f8bb525a74..9017609cadd9 100644 --- a/arch/x86/kernel/cpu/mcheck/mce_64.c +++ b/arch/x86/kernel/cpu/mcheck/mce_64.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/kdebug.h> | 28 | #include <linux/kdebug.h> |
29 | #include <linux/kobject.h> | 29 | #include <linux/kobject.h> |
30 | #include <linux/sysfs.h> | 30 | #include <linux/sysfs.h> |
31 | #include <linux/ratelimit.h> | ||
31 | #include <asm/processor.h> | 32 | #include <asm/processor.h> |
32 | #include <asm/msr.h> | 33 | #include <asm/msr.h> |
33 | #include <asm/mce.h> | 34 | #include <asm/mce.h> |
@@ -488,11 +489,11 @@ static DECLARE_WORK(mce_trigger_work, mce_do_trigger); | |||
488 | */ | 489 | */ |
489 | int mce_notify_user(void) | 490 | int mce_notify_user(void) |
490 | { | 491 | { |
492 | /* Not more than two messages every minute */ | ||
493 | static DEFINE_RATELIMIT_STATE(ratelimit, 60*HZ, 2); | ||
494 | |||
491 | clear_thread_flag(TIF_MCE_NOTIFY); | 495 | clear_thread_flag(TIF_MCE_NOTIFY); |
492 | if (test_and_clear_bit(0, ¬ify_user)) { | 496 | if (test_and_clear_bit(0, ¬ify_user)) { |
493 | static unsigned long last_print; | ||
494 | unsigned long now = jiffies; | ||
495 | |||
496 | wake_up_interruptible(&mce_wait); | 497 | wake_up_interruptible(&mce_wait); |
497 | 498 | ||
498 | /* | 499 | /* |
@@ -503,10 +504,8 @@ int mce_notify_user(void) | |||
503 | if (trigger[0] && !work_pending(&mce_trigger_work)) | 504 | if (trigger[0] && !work_pending(&mce_trigger_work)) |
504 | schedule_work(&mce_trigger_work); | 505 | schedule_work(&mce_trigger_work); |
505 | 506 | ||
506 | if (time_after_eq(now, last_print + (check_interval*HZ))) { | 507 | if (__ratelimit(&ratelimit)) |
507 | last_print = now; | ||
508 | printk(KERN_INFO "Machine check events logged\n"); | 508 | printk(KERN_INFO "Machine check events logged\n"); |
509 | } | ||
510 | 509 | ||
511 | return 1; | 510 | return 1; |
512 | } | 511 | } |