Skip to content

Commit

Permalink
s390/kdump,bootmem: fix bootmem allocator bitmap size
Browse files Browse the repository at this point in the history
When in kdump mode the kernel may access only the first couple of
megabytes for execution, the rest contains the dump. However
the size of the bitmap used by the bootmem allocator was calculated
for the whole amount of memory of the machine.

For very large machines this can lead to the situation that the kdump
kernel will not come up because not enough memory is available.

So fix this and calculate the size of the bitmap only for the piece
of memory that the kdump kernel actually uses.

Call reserve_oldmem() before setup_memory_end() so that the memory_chunk
array already has been updated with respect to oldmem chunks.
Afterwards setup_memory_end() will ignore those chunks.

Reviewed-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
  • Loading branch information
Heiko Carstens authored and Martin Schwidefsky committed May 2, 2013
1 parent 118131a commit 67b5c3e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion arch/s390/kernel/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,8 @@ static void __init setup_memory_end(void)
unsigned long align;

chunk = &memory_chunk[i];
if (chunk->type == CHUNK_OLDMEM)
continue;
align = 1UL << (MAX_ORDER + PAGE_SHIFT - 1);
start = (chunk->addr + align - 1) & ~(align - 1);
end = (chunk->addr + chunk->size) & ~(align - 1);
Expand Down Expand Up @@ -577,6 +579,8 @@ static void __init setup_memory_end(void)
for (i = 0; i < MEMORY_CHUNKS; i++) {
struct mem_chunk *chunk = &memory_chunk[i];

if (chunk->type == CHUNK_OLDMEM)
continue;
if (chunk->addr >= memory_end) {
memset(chunk, 0, sizeof(*chunk));
continue;
Expand Down Expand Up @@ -1065,9 +1069,9 @@ void __init setup_arch(char **cmdline_p)

os_info_init();
setup_ipl();
reserve_oldmem();
setup_memory_end();
setup_addressing_mode();
reserve_oldmem();
reserve_crashkernel();
setup_memory();
setup_resources();
Expand Down

0 comments on commit 67b5c3e

Please sign in to comment.