aboutsummaryrefslogtreecommitdiffstats
path: root/mm/page_alloc.c
diff options
context:
space:
mode:
authorHugh Dickins <hugh@veritas.com>2009-01-06 14:40:12 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2009-01-06 15:59:07 -0800
commitd936cf9b39b06c8d2e0d7fb5e7b4f176e18dec69 (patch)
treedb691451bc77e90b980b62674519731c6ece72db /mm/page_alloc.c
parentbadpage: remove vma from page_remove_rmap (diff)
downloadlinux-dev-d936cf9b39b06c8d2e0d7fb5e7b4f176e18dec69.tar.xz
linux-dev-d936cf9b39b06c8d2e0d7fb5e7b4f176e18dec69.zip
badpage: ratelimit print_bad_pte and bad_page
print_bad_pte() and bad_page() might each need ratelimiting - especially for their dump_stacks, almost never of interest, yet not quite dispensible. Correlating corruption across neighbouring entries can be very helpful, so allow a burst of 60 reports before keeping quiet for the remainder of that minute (or allow a steady drip of one report per second). Signed-off-by: Hugh Dickins <hugh@veritas.com> Cc: Nick Piggin <nickpiggin@yahoo.com.au> Cc: Christoph Lameter <cl@linux-foundation.org> Cc: Mel Gorman <mel@csn.ul.ie> Cc: Rik van Riel <riel@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/page_alloc.c')
-rw-r--r--mm/page_alloc.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 755c99a0ac71..d1a80f652c6f 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -223,6 +223,30 @@ static inline int bad_range(struct zone *zone, struct page *page)
static void bad_page(struct page *page)
{
+ static unsigned long resume;
+ static unsigned long nr_shown;
+ static unsigned long nr_unshown;
+
+ /*
+ * Allow a burst of 60 reports, then keep quiet for that minute;
+ * or allow a steady drip of one report per second.
+ */
+ if (nr_shown == 60) {
+ if (time_before(jiffies, resume)) {
+ nr_unshown++;
+ goto out;
+ }
+ if (nr_unshown) {
+ printk(KERN_EMERG
+ "Bad page state: %lu messages suppressed\n",
+ nr_unshown);
+ nr_unshown = 0;
+ }
+ nr_shown = 0;
+ }
+ if (nr_shown++ == 0)
+ resume = jiffies + 60 * HZ;
+
printk(KERN_EMERG "Bad page state in process %s pfn:%05lx\n",
current->comm, page_to_pfn(page));
printk(KERN_EMERG
@@ -232,7 +256,7 @@ static void bad_page(struct page *page)
printk(KERN_EMERG "Trying to fix it up, but a reboot is needed\n");
dump_stack();
-
+out:
/* Leave bad fields for debug, except PageBuddy could make trouble */
__ClearPageBuddy(page);
add_taint(TAINT_BAD_PAGE);