Commit 22293e58 authored by Venki Pallipadi's avatar Venki Pallipadi Committed by Linus Torvalds

x86: round_jiffies() for i386 and x86-64 non-critical/corrected MCE polling

This helps to reduce the frequency at which the CPU must be taken out of a
lower-power state.
Signed-off-by: default avatarVenkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Acked-by: default avatarTim Hockin <thockin@hockin.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarAndi Kleen <ak@suse.de>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 45902954
...@@ -57,7 +57,7 @@ static DECLARE_DELAYED_WORK(mce_work, mce_work_fn); ...@@ -57,7 +57,7 @@ static DECLARE_DELAYED_WORK(mce_work, mce_work_fn);
static void mce_work_fn(struct work_struct *work) static void mce_work_fn(struct work_struct *work)
{ {
on_each_cpu(mce_checkregs, NULL, 1, 1); on_each_cpu(mce_checkregs, NULL, 1, 1);
schedule_delayed_work(&mce_work, MCE_RATE); schedule_delayed_work(&mce_work, round_jiffies_relative(MCE_RATE));
} }
static int __init init_nonfatal_mce_checker(void) static int __init init_nonfatal_mce_checker(void)
...@@ -82,7 +82,7 @@ static int __init init_nonfatal_mce_checker(void) ...@@ -82,7 +82,7 @@ static int __init init_nonfatal_mce_checker(void)
/* /*
* Check for non-fatal errors every MCE_RATE s * Check for non-fatal errors every MCE_RATE s
*/ */
schedule_delayed_work(&mce_work, MCE_RATE); schedule_delayed_work(&mce_work, round_jiffies_relative(MCE_RATE));
printk(KERN_INFO "Machine check exception polling timer started.\n"); printk(KERN_INFO "Machine check exception polling timer started.\n");
return 0; return 0;
} }
......
...@@ -375,7 +375,8 @@ static void mcheck_timer(struct work_struct *work) ...@@ -375,7 +375,8 @@ static void mcheck_timer(struct work_struct *work)
if (mce_notify_user()) { if (mce_notify_user()) {
next_interval = max(next_interval/2, HZ/100); next_interval = max(next_interval/2, HZ/100);
} else { } else {
next_interval = min(next_interval*2, check_interval*HZ); next_interval = min(next_interval*2,
(int)round_jiffies_relative(check_interval*HZ));
} }
schedule_delayed_work(&mcheck_work, next_interval); schedule_delayed_work(&mcheck_work, next_interval);
...@@ -428,7 +429,8 @@ static __init int periodic_mcheck_init(void) ...@@ -428,7 +429,8 @@ static __init int periodic_mcheck_init(void)
{ {
next_interval = check_interval * HZ; next_interval = check_interval * HZ;
if (next_interval) if (next_interval)
schedule_delayed_work(&mcheck_work, next_interval); schedule_delayed_work(&mcheck_work,
round_jiffies_relative(next_interval));
idle_notifier_register(&mce_idle_notifier); idle_notifier_register(&mce_idle_notifier);
return 0; return 0;
} }
...@@ -720,7 +722,8 @@ static void mce_restart(void) ...@@ -720,7 +722,8 @@ static void mce_restart(void)
on_each_cpu(mce_init, NULL, 1, 1); on_each_cpu(mce_init, NULL, 1, 1);
next_interval = check_interval * HZ; next_interval = check_interval * HZ;
if (next_interval) if (next_interval)
schedule_delayed_work(&mcheck_work, next_interval); schedule_delayed_work(&mcheck_work,
round_jiffies_relative(next_interval));
} }
static struct sysdev_class mce_sysclass = { static struct sysdev_class mce_sysclass = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment