From: Nick Piggin <nickpiggin@yahoo.com.au>
To: Andrew Morton <akpm@osdl.org>, Andy Whitcroft <apw@shadowen.org>,
Mel Gorman <mel@csn.ul.ie>,
stable@kernel.org, Linux Memory Management <linux-mm@kvack.org>
Subject: [patch 1/2] mm: detect bad zones
Date: Sun, 21 May 2006 18:22:03 +1000 [thread overview]
Message-ID: <4470232B.7040802@yahoo.com.au> (raw)
[-- Attachment #1: Type: text/plain, Size: 412 bytes --]
Hi,
I think the previous few patches / patchsets to handle the unaligned zone
thing aren't exactly what we want (at least, for 2.6.16.stable and 2.6.17).
Firstly, we need to check for buddies outside the zone span, not just those
which are in a different zone.
Secondly, I think aligned zones should be an opt-in thing. Performance hit
is not huge, but potential stability hit is.
--
SUSE Labs, Novell Inc.
[-- Attachment #2: mm-detect-bad-zones.patch --]
[-- Type: text/plain, Size: 1982 bytes --]
panic when zones fail correct alignment and other checks.
The alternative could be random and/or undetected corruption later.
Signed-off-by: Nick Piggin <npiggin@suse.de>
Index: linux-2.6/mm/page_alloc.c
===================================================================
--- linux-2.6.orig/mm/page_alloc.c 2006-05-19 13:15:51.000000000 +1000
+++ linux-2.6/mm/page_alloc.c 2006-05-21 12:22:44.000000000 +1000
@@ -2041,6 +2041,47 @@ static __meminit void zone_pcp_init(stru
zone->name, zone->present_pages, batch);
}
+static __meminit void zone_debug_checks(struct zone *zone)
+{
+ unsigned long pfn;
+ unsigned long start = zone->zone_start_pfn;
+ unsigned long end = start + zone->spanned_pages;
+ const unsigned long mask = ((1<<MAX_ORDER)-1);
+
+ if (start & mask)
+ panic("zone start pfn (%lx) not MAX_ORDER aligned\n", start);
+
+ if (end & mask)
+ panic("zone end pfn (%lx) not MAX_ORDER aligned\n", end);
+
+ for (pfn = start; pfn < end; pfn++) {
+ struct page *page;
+ int order;
+
+#ifndef CONFIG_HOLES_IN_ZONE
+ if (!pfn_valid(pfn))
+ panic("zone pfn (%lx) not valid\n", pfn);
+#endif
+
+ page = pfn_to_page(pfn);
+ if (page_zone(page) != zone)
+ panic("zone page (pfn %lx) in wrong zone\n", pfn);
+
+ for (order = 0; order < MAX_ORDER-1; order++) {
+ struct page *buddy;
+ buddy = __page_find_buddy(page, pfn & mask, order);
+
+#ifndef CONFIG_HOLES_IN_ZONE
+ if (!pfn_valid(page_to_pfn(buddy)))
+ panic("pfn (%lx) buddy (order %d) not valid\n", pfn, order);
+#endif
+
+ if (page_zone(buddy) != zone)
+ panic("pfn (%lx) buddy (order %d) in wrong zone\n", pfn, order);
+ }
+ }
+}
+
static __meminit void init_currently_empty_zone(struct zone *zone,
unsigned long zone_start_pfn, unsigned long size)
{
@@ -2054,6 +2095,8 @@ static __meminit void init_currently_emp
memmap_init(size, pgdat->node_id, zone_idx(zone), zone_start_pfn);
zone_init_free_lists(pgdat, zone, zone->spanned_pages);
+
+ zone_debug_checks(zone);
}
/*
next reply other threads:[~2006-05-21 8:22 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-05-21 8:22 Nick Piggin [this message]
2006-05-21 8:22 ` [patch 2/2] mm: handle unaligned zones Nick Piggin
2006-05-21 9:19 ` Andrew Morton
2006-05-21 10:31 ` Nick Piggin
2006-05-21 10:59 ` Andrew Morton
2006-05-21 11:44 ` Nick Piggin
2006-05-21 11:52 ` Nick Piggin
2006-05-22 9:24 ` Mel Gorman
2006-05-22 9:28 ` Mel Gorman
2006-05-22 9:06 ` Mel Gorman
2006-05-22 9:51 ` Nick Piggin
2006-05-21 11:53 ` Nick Piggin
2006-05-22 8:18 ` Andy Whitcroft
2006-05-22 9:37 ` Nick Piggin
2006-05-22 9:52 ` [PATCH 0/2] Zone boundary alignment fixes, default configuration Andy Whitcroft
2006-05-22 9:53 ` [PATCH 1/2] zone allow unaligned zone boundaries add configuration Andy Whitcroft
2006-05-22 9:53 ` [PATCH 2/2] x86 add zone alignment qualifier Andy Whitcroft
2006-05-25 11:19 ` [PATCH 0/2] Zone boundary alignment fixes, default configuration Andy Whitcroft
2006-05-31 0:13 ` [stable] " Chris Wright
2006-05-31 11:41 ` Nick Piggin
2006-05-31 12:08 ` Andy Whitcroft
2006-05-31 17:42 ` Greg KH
2006-05-31 17:16 ` Andy Whitcroft
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=4470232B.7040802@yahoo.com.au \
--to=nickpiggin@yahoo.com.au \
--cc=akpm@osdl.org \
--cc=apw@shadowen.org \
--cc=linux-mm@kvack.org \
--cc=mel@csn.ul.ie \
--cc=stable@kernel.org \
/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