Commit 6c1ad037 authored by Martin Schwidefsky's avatar Martin Schwidefsky Committed by Jiri Slaby

kexec: allocate the kexec control page with KEXEC_CONTROL_MEMORY_GFP

commit 7e01b5ac upstream.

Introduce KEXEC_CONTROL_MEMORY_GFP to allow the architecture code
to override the gfp flags of the allocation for the kexec control
page. The loop in kimage_alloc_normal_control_pages allocates pages
with GFP_KERNEL until a page is found that happens to have an
address smaller than the KEXEC_CONTROL_MEMORY_LIMIT. On systems
with a large memory size but a small KEXEC_CONTROL_MEMORY_LIMIT
the loop will keep allocating memory until the oom killer steps in.
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
parent cbe04187
...@@ -26,6 +26,9 @@ ...@@ -26,6 +26,9 @@
/* Not more than 2GB */ /* Not more than 2GB */
#define KEXEC_CONTROL_MEMORY_LIMIT (1UL<<31) #define KEXEC_CONTROL_MEMORY_LIMIT (1UL<<31)
/* Allocate control page with GFP_DMA */
#define KEXEC_CONTROL_MEMORY_GFP GFP_DMA
/* Maximum address we can use for the crash control pages */ /* Maximum address we can use for the crash control pages */
#define KEXEC_CRASH_CONTROL_MEMORY_LIMIT (-1UL) #define KEXEC_CRASH_CONTROL_MEMORY_LIMIT (-1UL)
......
...@@ -26,6 +26,10 @@ ...@@ -26,6 +26,10 @@
#error KEXEC_CONTROL_MEMORY_LIMIT not defined #error KEXEC_CONTROL_MEMORY_LIMIT not defined
#endif #endif
#ifndef KEXEC_CONTROL_MEMORY_GFP
#define KEXEC_CONTROL_MEMORY_GFP GFP_KERNEL
#endif
#ifndef KEXEC_CONTROL_PAGE_SIZE #ifndef KEXEC_CONTROL_PAGE_SIZE
#error KEXEC_CONTROL_PAGE_SIZE not defined #error KEXEC_CONTROL_PAGE_SIZE not defined
#endif #endif
......
...@@ -432,7 +432,7 @@ static struct page *kimage_alloc_normal_control_pages(struct kimage *image, ...@@ -432,7 +432,7 @@ static struct page *kimage_alloc_normal_control_pages(struct kimage *image,
do { do {
unsigned long pfn, epfn, addr, eaddr; unsigned long pfn, epfn, addr, eaddr;
pages = kimage_alloc_pages(GFP_KERNEL, order); pages = kimage_alloc_pages(KEXEC_CONTROL_MEMORY_GFP, order);
if (!pages) if (!pages)
break; break;
pfn = page_to_pfn(pages); pfn = page_to_pfn(pages);
......
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