Re: [PATCH 1/3] zone init check and report unaligned zone boundries

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Patchset looks nice, Andy. Page allocator stuff looks fine, just
a couple of questions about the setup and alignment stuff:

Andy Whitcroft wrote:
zone init check and report unaligned zone boundries

We have a number of strict constraints on the layout of struct
page's for use with the buddy allocator.  One of which is that zone
boundries must occur at MAX_ORDER page boundries.  Add a check for
this during init.

Signed-off-by: Andy Whitcroft <[email protected]>
---
 include/linux/mmzone.h |    5 +++++
 mm/page_alloc.c        |    4 ++++
 2 files changed, 9 insertions(+)
diff -upN reference/include/linux/mmzone.h current/include/linux/mmzone.h
--- reference/include/linux/mmzone.h
+++ current/include/linux/mmzone.h
@@ -388,6 +388,11 @@ static inline int is_dma(struct zone *zo
 	return zone == zone->zone_pgdat->node_zones + ZONE_DMA;
 }
+static inline unsigned long zone_boundry_align_pfn(unsigned long pfn)
+{
+	return pfn & ~((1 << MAX_ORDER) - 1);
+}
+
 /* These two functions are used to setup the per zone pages min values */
 struct ctl_table;
 struct file;
diff -upN reference/mm/page_alloc.c current/mm/page_alloc.c
--- reference/mm/page_alloc.c
+++ current/mm/page_alloc.c
@@ -2078,6 +2078,10 @@ static void __init free_area_init_core(s
 		struct zone *zone = pgdat->node_zones + j;
 		unsigned long size, realsize;
+ if (zone_boundry_align_pfn(zone_start_pfn) != zone_start_pfn)
+			printk(KERN_CRIT "node %d zone %s missaligned "
+					"start pfn\n", nid, zone_names[j]);
+


We also need to align the end of the zone I think? I think we should
try to force alignment by reducing the size here, or if that is not
possible, then panic?

If we don't either fix it or panic, then we're allowing users' machines
to run in an unstable state.

--
SUSE Labs, Novell Inc.
Send instant messages to your online friends http://au.messenger.yahoo.com -
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux