]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
[S390] Remove BUILD_BUG_ON() in vmem code.
authorHeiko Carstens <heiko.carstens@de.ibm.com>
Tue, 5 Feb 2008 15:50:49 +0000 (16:50 +0100)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Tue, 5 Feb 2008 15:51:01 +0000 (16:51 +0100)
Remove BUILD_BUG_ON() in vmem code since it causes build failures if
the size of struct page increases. Instead calculate at compile time
the address of the highest physical address that can be added to the
1:1 mapping.
This supposed to fix a build failure with the page owner tracking leak
detector patches as reported by akpm.

page-owner-tracking-leak-detector-broken-on-s390.patch can be removed
from -mm again when this is merged.

Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
arch/s390/kernel/setup.c
arch/s390/mm/vmem.c
include/asm-s390/pgtable.h

index 72d20f70f8a6e1d3574c4c4fdcbfa2a0d0e1add5..29ae165d174931b0d7b1775e3690c1be23d5c8f9 100644 (file)
@@ -528,7 +528,7 @@ static void __init setup_memory_end(void)
        memory_size = 0;
        memory_end &= PAGE_MASK;
 
-       max_mem = memory_end ? min(VMALLOC_START, memory_end) : VMALLOC_START;
+       max_mem = memory_end ? min(VMEM_MAX_PHYS, memory_end) : VMEM_MAX_PHYS;
        memory_end = min(max_mem, memory_end);
 
        /*
index 07e046777243ceb2ec703fc3e2f8987940118ec4..7c1287ccf78864fee054865ef9afd97193497d93 100644 (file)
@@ -250,7 +250,7 @@ static int insert_memory_segment(struct memory_segment *seg)
 {
        struct memory_segment *tmp;
 
-       if (seg->start + seg->size >= VMALLOC_START ||
+       if (seg->start + seg->size >= VMEM_MAX_PHYS ||
            seg->start + seg->size < seg->start)
                return -ERANGE;
 
@@ -360,7 +360,6 @@ void __init vmem_map_init(void)
 {
        int i;
 
-       BUILD_BUG_ON((unsigned long)VMEM_MAP + VMEM_MAP_SIZE > VMEM_MAP_MAX);
        NODE_DATA(0)->node_mem_map = VMEM_MAP;
        for (i = 0; i < MEMORY_CHUNKS && memory_chunk[i].size > 0; i++)
                vmem_add_mem(memory_chunk[i].addr, memory_chunk[i].size);
index 79b9eab1a0c71bc25ffbee10582c1267e2aecb3e..3f520754e71c4472db5d2570cb42cd8a795ab7d1 100644 (file)
@@ -115,15 +115,21 @@ extern char empty_zero_page[PAGE_SIZE];
 #ifndef __s390x__
 #define VMALLOC_START  0x78000000UL
 #define VMALLOC_END    0x7e000000UL
-#define VMEM_MAP_MAX   0x80000000UL
+#define VMEM_MAP_END   0x80000000UL
 #else /* __s390x__ */
 #define VMALLOC_START  0x3e000000000UL
 #define VMALLOC_END    0x3e040000000UL
-#define VMEM_MAP_MAX   0x40000000000UL
+#define VMEM_MAP_END   0x40000000000UL
 #endif /* __s390x__ */
 
+/*
+ * VMEM_MAX_PHYS is the highest physical address that can be added to the 1:1
+ * mapping. This needs to be calculated at compile time since the size of the
+ * VMEM_MAP is static but the size of struct page can change.
+ */
+#define VMEM_MAX_PHYS  min(VMALLOC_START, ((VMEM_MAP_END - VMALLOC_END) / \
+                         sizeof(struct page) * PAGE_SIZE) & ~((16 << 20) - 1))
 #define VMEM_MAP       ((struct page *) VMALLOC_END)
-#define VMEM_MAP_SIZE  ((VMALLOC_START / PAGE_SIZE) * sizeof(struct page))
 
 /*
  * A 31 bit pagetable entry of S390 has following format: