Commit c9e37353 authored by Heiko Carstens's avatar Heiko Carstens Committed by Linus Torvalds

[PATCH] s390: fix memory holes and cleanup setup_arch

The memory setup didn't take care of memory holes and this makes the memory
management think there would be more memory available than there is in
reality.  That causes the OOM killer to kill processes even if there is enough
memory left that can be written to the swap space.

The patch fixes this by using free_area_init_node with an array of memory
holes instead of free_area_init.  Further the patch cleans up the code in
setup.c by splitting setup_arch into smaller pieces.
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 4b7e0706
This diff is collapsed.
...@@ -101,6 +101,7 @@ extern unsigned long _end; ...@@ -101,6 +101,7 @@ extern unsigned long _end;
extern unsigned long __init_begin; extern unsigned long __init_begin;
extern unsigned long __init_end; extern unsigned long __init_end;
extern unsigned long __initdata zholes_size[];
/* /*
* paging_init() sets up the page tables * paging_init() sets up the page tables
*/ */
...@@ -163,10 +164,13 @@ void __init paging_init(void) ...@@ -163,10 +164,13 @@ void __init paging_init(void)
local_flush_tlb(); local_flush_tlb();
{ {
unsigned long zones_size[MAX_NR_ZONES] = { 0, 0, 0}; unsigned long zones_size[MAX_NR_ZONES];
memset(zones_size, 0, sizeof(zones_size));
zones_size[ZONE_DMA] = max_low_pfn; zones_size[ZONE_DMA] = max_low_pfn;
free_area_init(zones_size); free_area_init_node(0, &contig_page_data, zones_size,
__pa(PAGE_OFFSET) >> PAGE_SHIFT,
zholes_size);
} }
return; return;
} }
...@@ -184,9 +188,10 @@ void __init paging_init(void) ...@@ -184,9 +188,10 @@ void __init paging_init(void)
_KERN_REGION_TABLE; _KERN_REGION_TABLE;
static const int ssm_mask = 0x04000000L; static const int ssm_mask = 0x04000000L;
unsigned long zones_size[MAX_NR_ZONES] = {0, 0, 0}; unsigned long zones_size[MAX_NR_ZONES];
unsigned long dma_pfn, high_pfn; unsigned long dma_pfn, high_pfn;
memset(zones_size, 0, sizeof(zones_size));
dma_pfn = MAX_DMA_ADDRESS >> PAGE_SHIFT; dma_pfn = MAX_DMA_ADDRESS >> PAGE_SHIFT;
high_pfn = max_low_pfn; high_pfn = max_low_pfn;
...@@ -198,8 +203,8 @@ void __init paging_init(void) ...@@ -198,8 +203,8 @@ void __init paging_init(void)
} }
/* Initialize mem_map[]. */ /* Initialize mem_map[]. */
free_area_init(zones_size); free_area_init_node(0, &contig_page_data, zones_size,
__pa(PAGE_OFFSET) >> PAGE_SHIFT, zholes_size);
/* /*
* map whole physical memory to virtual memory (identity mapping) * map whole physical memory to virtual memory (identity mapping)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment