[S390] Remove BUILD_BUG_ON() in vmem code.

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>

authored by Heiko Carstens and committed by Martin Schwidefsky 0189103c e35e1fad

+11 -6
+1 -1
arch/s390/kernel/setup.c
··· 528 528 memory_size = 0; 529 529 memory_end &= PAGE_MASK; 530 530 531 - max_mem = memory_end ? min(VMALLOC_START, memory_end) : VMALLOC_START; 531 + max_mem = memory_end ? min(VMEM_MAX_PHYS, memory_end) : VMEM_MAX_PHYS; 532 532 memory_end = min(max_mem, memory_end); 533 533 534 534 /*
+1 -2
arch/s390/mm/vmem.c
··· 250 250 { 251 251 struct memory_segment *tmp; 252 252 253 - if (seg->start + seg->size >= VMALLOC_START || 253 + if (seg->start + seg->size >= VMEM_MAX_PHYS || 254 254 seg->start + seg->size < seg->start) 255 255 return -ERANGE; 256 256 ··· 360 360 { 361 361 int i; 362 362 363 - BUILD_BUG_ON((unsigned long)VMEM_MAP + VMEM_MAP_SIZE > VMEM_MAP_MAX); 364 363 NODE_DATA(0)->node_mem_map = VMEM_MAP; 365 364 for (i = 0; i < MEMORY_CHUNKS && memory_chunk[i].size > 0; i++) 366 365 vmem_add_mem(memory_chunk[i].addr, memory_chunk[i].size);
+9 -3
include/asm-s390/pgtable.h
··· 115 115 #ifndef __s390x__ 116 116 #define VMALLOC_START 0x78000000UL 117 117 #define VMALLOC_END 0x7e000000UL 118 - #define VMEM_MAP_MAX 0x80000000UL 118 + #define VMEM_MAP_END 0x80000000UL 119 119 #else /* __s390x__ */ 120 120 #define VMALLOC_START 0x3e000000000UL 121 121 #define VMALLOC_END 0x3e040000000UL 122 - #define VMEM_MAP_MAX 0x40000000000UL 122 + #define VMEM_MAP_END 0x40000000000UL 123 123 #endif /* __s390x__ */ 124 124 125 + /* 126 + * VMEM_MAX_PHYS is the highest physical address that can be added to the 1:1 127 + * mapping. This needs to be calculated at compile time since the size of the 128 + * VMEM_MAP is static but the size of struct page can change. 129 + */ 130 + #define VMEM_MAX_PHYS min(VMALLOC_START, ((VMEM_MAP_END - VMALLOC_END) / \ 131 + sizeof(struct page) * PAGE_SIZE) & ~((16 << 20) - 1)) 125 132 #define VMEM_MAP ((struct page *) VMALLOC_END) 126 - #define VMEM_MAP_SIZE ((VMALLOC_START / PAGE_SIZE) * sizeof(struct page)) 127 133 128 134 /* 129 135 * A 31 bit pagetable entry of S390 has following format: