Commit 50def269 authored by Arvind Sankar's avatar Arvind Sankar Committed by Ingo Molnar

x86/kaslr: Short-circuit gb_huge_pages on x86-32

32-bit does not have GB pages, so don't bother checking for them. Using
the IS_ENABLED() macro allows the compiler to completely remove the
gb_huge_pages code.
Signed-off-by: default avatarArvind Sankar <nivedita@alum.mit.edu>
Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/r/20200728225722.67457-12-nivedita@alum.mit.edu
parent 79c2fd2a
...@@ -303,7 +303,7 @@ static void handle_mem_options(void) ...@@ -303,7 +303,7 @@ static void handle_mem_options(void)
if (!strcmp(param, "memmap")) { if (!strcmp(param, "memmap")) {
mem_avoid_memmap(PARSE_MEMMAP, val); mem_avoid_memmap(PARSE_MEMMAP, val);
} else if (strstr(param, "hugepages")) { } else if (IS_ENABLED(CONFIG_X86_64) && strstr(param, "hugepages")) {
parse_gb_huge_pages(param, val); parse_gb_huge_pages(param, val);
} else if (!strcmp(param, "mem")) { } else if (!strcmp(param, "mem")) {
char *p = val; char *p = val;
...@@ -551,7 +551,7 @@ process_gb_huge_pages(struct mem_vector *region, unsigned long image_size) ...@@ -551,7 +551,7 @@ process_gb_huge_pages(struct mem_vector *region, unsigned long image_size)
struct mem_vector tmp; struct mem_vector tmp;
int i = 0; int i = 0;
if (!max_gb_huge_pages) { if (!IS_ENABLED(CONFIG_X86_64) || !max_gb_huge_pages) {
store_slot_info(region, image_size); store_slot_info(region, image_size);
return; return;
} }
......
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