public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Arjan van de Ven <arjan@infradead.org>
To: linux-kernel@vger.kernel.org
Cc: Arjan van de Ven <arjan@infradead.org>,
	mingo@elte.hu, Hugh Dickins <hugh@veritas.com>,
	Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Subject: [PATCH 2/2] corruption check: run the corruption checks from a work queue
Date: Mon, 22 Sep 2008 14:05:03 -0700	[thread overview]
Message-ID: <20080922140503.5f3a3db3@infradead.org> (raw)
In-Reply-To: <20080922140402.166de1ba@infradead.org>


From: Arjan van de Ven <arjan@linux.intel.com>
Date: Mon, 22 Sep 2008 13:42:15 -0700
Subject: [PATCH] corruption check: run the corruption checks from a work queue

the 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 (including interrupt latency)

Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
---
 arch/x86/kernel/corruptioncheck.c |   21 +++++++++++++++++----
 arch/x86/mm/init_32.c             |    2 --
 arch/x86/mm/init_64.c             |    2 --
 include/linux/kernel.h            |    2 +-
 4 files changed, 18 insertions(+), 9 deletions(-)

diff --git a/arch/x86/kernel/corruptioncheck.c b/arch/x86/kernel/corruptioncheck.c
index a7e80ed..cd89219 100644
--- a/arch/x86/kernel/corruptioncheck.c
+++ b/arch/x86/kernel/corruptioncheck.c
@@ -1,5 +1,6 @@
 #include <linux/module.h>
 #include <linux/sched.h>
+#include <linux/kthread.h>
 
 #include <asm/e820.h>
 #include <asm/proto.h>
@@ -135,22 +136,34 @@ 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)
 {
 	check_for_bios_corruption();
+}
+
+static void periodic_check_for_corruption(unsigned long data)
+{
+	static DECLARE_WORK(corruptioncheck_work, check_corruption);
+	schedule_work(&corruptioncheck_work);
 	mod_timer(&periodic_check_timer, round_jiffies(jiffies + corruption_check_period*HZ));
 }
 
-void start_periodic_check_for_corruption(void)
+
+
+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);
+	mod_timer(&periodic_check_timer, round_jiffies(jiffies + corruption_check_period*HZ));
+//	periodic_check_for_corruption(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 b4c3a92..16ea9d0 100644
--- a/arch/x86/mm/init_32.c
+++ b/arch/x86/mm/init_32.c
@@ -905,8 +905,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 b565721..b65492e 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -822,8 +822,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 */
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index a5afee2..01085d2 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -260,7 +260,7 @@ extern int root_mountflags;
  * able to scatter it around anywhere in the kernel.
  */
 void check_for_bios_corruption(void);
-void start_periodic_check_for_corruption(void);
+int start_periodic_check_for_corruption(void);
 #else
 static inline void check_for_bios_corruption(void)
 {
-- 
1.5.5.1



-- 
Arjan van de Ven 	Intel Open Source Technology Centre
For development, discussion and tips for power savings, 
visit http://www.lesswatts.org

  reply	other threads:[~2008-09-22 21:05 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-21  3:35 [PATCH] x86: use round_jiffies() for the corruption check timer Arjan van de Ven
2008-09-22  8:29 ` Ingo Molnar
2008-09-22 21:04 ` [PATCH 1/2] corruption check: move the corruption checks into their own file Arjan van de Ven
2008-09-22 21:05   ` Arjan van de Ven [this message]
2008-09-22 23:24     ` [PATCH 2/2] corruption check: run the corruption checks from a work queue Arjan van de Ven
2008-09-22 23:28       ` Randy.Dunlap
2008-09-22 23:39         ` Arjan van de Ven
2008-09-23 11:33           ` Ingo Molnar
  -- strict thread matches above, loose matches on Subject: below --
2008-09-23  2:58 [PATCH 1/2] corruption check: move the corruption checks into their own file Arjan van de Ven
2008-09-23  2:58 ` [PATCH 2/2] corruption check: run the corruption checks from a work queue Arjan van de Ven
2008-09-23  6:03   ` Jeremy Fitzhardinge

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080922140503.5f3a3db3@infradead.org \
    --to=arjan@infradead.org \
    --cc=hugh@veritas.com \
    --cc=jeremy.fitzhardinge@citrix.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox