aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/check.c
diff options
context:
space:
mode:
authorArjan van de Ven <arjan@infradead.org>2008-10-05 15:09:03 -0400
committerIngo Molnar <mingo@elte.hu>2008-10-27 13:09:45 -0400
commit304e629bf4a3150a0bf6556fc45c52c5c082340f (patch)
tree26fb35d1e1b3c44411b0198a484e65f7f466bcee /arch/x86/kernel/check.c
parent6784f7d0a5016a397d38be1134e63fc784c1ca8e (diff)
x86: corruption check: run the corruption checks from a work queue
Impact: change the implementation of the debug feature the periodic corruption checks are better off run from a work queue; there's nothing time critical about them and this way the amount of interrupt-context work is reduced. Signed-off-by: Arjan van de Ven <arjan@linux.intel.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/check.c')
-rw-r--r--arch/x86/kernel/check.c27
1 files changed, 17 insertions, 10 deletions
diff --git a/arch/x86/kernel/check.c b/arch/x86/kernel/check.c
index 5056703e1b05..55eed1752b43 100644
--- a/arch/x86/kernel/check.c
+++ b/arch/x86/kernel/check.c
@@ -1,6 +1,7 @@
1#include <linux/module.h> 1#include <linux/module.h>
2#include <linux/sched.h> 2#include <linux/sched.h>
3 3#include <linux/kthread.h>
4#include <linux/workqueue.h>
4#include <asm/e820.h> 5#include <asm/e820.h>
5#include <asm/proto.h> 6#include <asm/proto.h>
6 7
@@ -108,13 +109,14 @@ void __init setup_bios_corruption_check(void)
108 update_e820(); 109 update_e820();
109} 110}
110 111
111static struct timer_list periodic_check_timer;
112 112
113void check_for_bios_corruption(void) 113void check_for_bios_corruption(void)
114{ 114{
115 int i; 115 int i;
116 int corruption = 0; 116 int corruption = 0;
117 117
118 printk("dot\n");
119
118 if (!memory_corruption_check) 120 if (!memory_corruption_check)
119 return; 121 return;
120 122
@@ -135,24 +137,29 @@ void check_for_bios_corruption(void)
135 WARN(corruption, KERN_ERR "Memory corruption detected in low memory\n"); 137 WARN(corruption, KERN_ERR "Memory corruption detected in low memory\n");
136} 138}
137 139
138static void periodic_check_for_corruption(unsigned long data) 140static void check_corruption(struct work_struct *dummy);
141static DECLARE_DELAYED_WORK(bios_check_work, check_corruption);
142
143static void check_corruption(struct work_struct *dummy)
139{ 144{
140 check_for_bios_corruption(); 145 check_for_bios_corruption();
141 mod_timer(&periodic_check_timer, 146 schedule_delayed_work(&bios_check_work,
142 round_jiffies(jiffies + corruption_check_period*HZ)); 147 round_jiffies_relative(corruption_check_period*HZ));
143} 148}
144 149
145void start_periodic_check_for_corruption(void) 150static int start_periodic_check_for_corruption(void)
146{ 151{
147 if (!memory_corruption_check || corruption_check_period == 0) 152 if (!memory_corruption_check || corruption_check_period == 0)
148 return; 153 return 0;
149 154
150 printk(KERN_INFO "Scanning for low memory corruption every %d seconds\n", 155 printk(KERN_INFO "Scanning for low memory corruption every %d seconds\n",
151 corruption_check_period); 156 corruption_check_period);
152 157
153 init_timer(&periodic_check_timer); 158 /* First time we run the checks right away */
154 periodic_check_timer.function = &periodic_check_for_corruption; 159 schedule_delayed_work(&bios_check_work, 0);
155 periodic_check_for_corruption(0); 160 return 0;
156} 161}
162
163module_init(start_periodic_check_for_corruption);
157#endif 164#endif
158 165