aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArjan van de Ven <arjan@infradead.org>2008-10-05 12:09:03 -0700
committerIngo Molnar <mingo@elte.hu>2008-10-27 18:09:45 +0100
commit304e629bf4a3150a0bf6556fc45c52c5c082340f (patch)
tree26fb35d1e1b3c44411b0198a484e65f7f466bcee
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>
-rw-r--r--arch/x86/kernel/check.c27
-rw-r--r--arch/x86/mm/init_32.c2
-rw-r--r--arch/x86/mm/init_64.c2
3 files changed, 17 insertions, 14 deletions
diff --git a/arch/x86/kernel/check.c b/arch/x86/kernel/check.c
index 5056703e1b0..55eed1752b4 100644
--- a/arch/x86/kernel/check.c
+++ b/arch/x86/kernel/check.c
@@ -1,6 +1,7 @@
#include <linux/module.h>
#include <linux/sched.h>
-
+#include <linux/kthread.h>
+#include <linux/workqueue.h>
#include <asm/e820.h>
#include <asm/proto.h>
@@ -108,13 +109,14 @@ void __init setup_bios_corruption_check(void)
update_e820();
}
-static struct timer_list periodic_check_timer;
void check_for_bios_corruption(void)
{
int i;
int corruption = 0;
+ printk("dot\n");
+
if (!memory_corruption_check)
return;
@@ -135,24 +137,29 @@ void check_for_bios_corruption(void)
WARN(corruption, KERN_ERR "Memory corruption detected in low memory\n");
}
-static void periodic_check_for_corruption(unsigned long data)
+static void check_corruption(struct work_struct *dummy);
+static DECLARE_DELAYED_WORK(bios_check_work, check_corruption);
+
+static void check_corruption(struct work_struct *dummy)
{
check_for_bios_corruption();
- mod_timer(&periodic_check_timer,
- round_jiffies(jiffies + corruption_check_period*HZ));
+ schedule_delayed_work(&bios_check_work,
+ round_jiffies_relative(corruption_check_period*HZ));
}
-void start_periodic_check_for_corruption(void)
+static int start_periodic_check_for_corruption(void)
{
if (!memory_corruption_check || corruption_check_period == 0)
- return;
+ return 0;
printk(KERN_INFO "Scanning for low memory corruption every %d seconds\n",
corruption_check_period);
- init_timer(&periodic_check_timer);
- periodic_check_timer.function = &periodic_check_for_corruption;
- periodic_check_for_corruption(0);
+ /* First time we run the checks right away */
+ schedule_delayed_work(&bios_check_work, 0);
+ return 0;
}
+
+module_init(start_periodic_check_for_corruption);
#endif
diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
index 8396868e82c..5e6377560ff 100644
--- a/arch/x86/mm/init_32.c
+++ b/arch/x86/mm/init_32.c
@@ -970,8 +970,6 @@ void __init mem_init(void)
int codesize, reservedpages, datasize, initsize;
int tmp;
- start_periodic_check_for_corruption();
-
#ifdef CONFIG_FLATMEM
BUG_ON(!mem_map);
#endif
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index b8e461d4941..d6ef1589b95 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -879,8 +879,6 @@ void __init mem_init(void)
{
long codesize, reservedpages, datasize, initsize;
- start_periodic_check_for_corruption();
-
pci_iommu_alloc();
/* clear_bss() already clear the empty_zero_page */