]> git.hungrycats.org Git - linux/commitdiff
[PATCH] Give a compile-time error on the v850 if MAX_ORDER is too large
authorMiles Bader <miles@lsi.nec.co.jp>
Tue, 26 Nov 2002 13:21:13 +0000 (05:21 -0800)
committerLinus Torvalds <torvalds@home.transmeta.com>
Tue, 26 Nov 2002 13:21:13 +0000 (05:21 -0800)
Give a compile-time error on the v850 if MAX_ORDER is too large

arch/v850/kernel/setup.c

index d4445fdc5925bbd0c6863702d2b4c443ae82eb31..9100ec7f6ed766852fbd4953eca13aab1937ccc2 100644 (file)
@@ -270,6 +270,16 @@ init_mem_alloc (unsigned long ram_start, unsigned long ram_len)
        zones_size[ZONE_DMA]
                = ADDR_TO_PAGE (ram_len + (ram_start - PAGE_OFFSET));
 
+       /* The allocator is very picky about the address of the first
+          allocatable page -- it must be at least as aligned as the
+          maximum allocation -- so try to detect cases where it will get
+          confused and signal them at compile time (this is a common
+          problem when porting to a new platform with ).  There is a
+          similar runtime check in free_area_init_core.  */
+#if ((PAGE_OFFSET >> PAGE_SHIFT) & ((1UL << (MAX_ORDER - 1)) - 1))
+#error MAX_ORDER is too large for given PAGE_OFFSET (use CONFIG_FORCE_MAX_ZONEORDER to change it)
+#endif
+
        free_area_init_node (0, NODE_DATA(0), 0, zones_size,
                             ADDR_TO_PAGE (PAGE_OFFSET), 0);
        mem_map = NODE_DATA(0)->node_mem_map;