powerpc/mm/4k: Limit 4k page size config to 64TB virtual address space
PATCH 1/1 powerpc/mm/4k: Limit 4k page size config to 64TB virtual address space
Supporting 512TB requires us to do a order 3 allocation for level 1 page table(pgd). This results in page allocation failures with certain workloads. For now limit 4k linux page size config to 64TB.
Signed-off-by Aneesh Kumar K.V <[email protected]>
--- arch/powerpc/include/asm/book3s/64/hash-4k.h | 2 +- arch/powerpc/include/asm/processor.h | 25 ++++++++++++------------- arch/powerpc/kernel/setup-common.c | 2 +- arch/powerpc/mm/mmu_context_book3s64.c | 2 +- 4 files changed, 15 insertions(+), 16 deletions(-)
arch/powerpc/include/asm/book3s/64/hash-4k.h +1 -1
@@ -8,7 +8,7 @@#define H_PTE_INDEX_SIZE 9#define H_PMD_INDEX_SIZE 7#define H_PUD_INDEX_SIZE 9 -#define H_PGD_INDEX_SIZE 12 +#define H_PGD_INDEX_SIZE 9#ifndef __ASSEMBLY__#define H_PTE_TABLE_SIZE (sizeof(pte_t) << H_PTE_INDEX_SIZE)
arch/powerpc/include/asm/processor.h +12 -13
@@ -110,13 +110,18 @@ void release_thread(struct task_struct *);#define TASK_SIZE_128TB (0x0000800000000000UL)#define TASK_SIZE_512TB (0x0002000000000000UL) -#ifdef CONFIG_PPC_BOOK3S_64 +/* +* For now 512TB is only supported with book3s and 64K linux page size. +*/ +#if defined(CONFIG_PPC_BOOK3S_64 ) && defined(CONFIG_PPC_64K_PAGES )/* * Max value currently used: */ -#define TASK_SIZE_USER64 TASK_SIZE_512TB +#define TASK_SIZE_USER64 TASK_SIZE_512TB +#define DEFAULT_MAP_WINDOW_USER64 TASK_SIZE_128TB#else -#define TASK_SIZE_USER64 TASK_SIZE_64TB +#define TASK_SIZE_USER64 TASK_SIZE_64TB +#define DEFAULT_MAP_WINDOW_USER64 TASK_SIZE_64TB#endif /*
@@ -132,7 +137,7 @@ void release_thread(struct task_struct *);* space during mmap's. */ #define TASK_UNMAPPED_BASE_USER32 (PAGE_ALIGN(TASK_SIZE_USER32 / 4)) -#define TASK_UNMAPPED_BASE_USER64 (PAGE_ALIGN(TASK_SIZE_128TB / 4)) +#define TASK_UNMAPPED_BASE_USER64 (PAGE_ALIGN(DEFAULT_MAP_WINDOW_USER64 / 4))#define TASK_UNMAPPED_BASE ((is_32bit_task()) ? \ TASK_UNMAPPED_BASE_USER32 : TASK_UNMAPPED_BASE_USER64 )
@@ -143,21 +148,15 @@ void release_thread(struct task_struct *);* with 128TB and conditionally enable upto 512TB */ #ifdef CONFIG_PPC_BOOK3S_64 -#define DEFAULT_MAP_WINDOW ((is_32bit_task()) ? \ - TASK_SIZE_USER32 : TASK_SIZE_128TB) +#define DEFAULT_MAP_WINDOW ((is_32bit_task()) ? \ + TASK_SIZE_USER32 : DEFAULT_MAP_WINDOW_USER64)#else #define DEFAULT_MAP_WINDOW TASK_SIZE#endif #ifdef __powerpc64__ -#ifdef CONFIG_PPC_BOOK3S_64 -/* Limit stack to 128TB */ -#define STACK_TOP_USER64 TASK_SIZE_128TB -#else -#define STACK_TOP_USER64 TASK_SIZE_USER64 -#endif - +#define STACK_TOP_USER64 DEFAULT_MAP_WINDOW_USER64#define STACK_TOP_USER32 TASK_SIZE_USER32#define STACK_TOP (is_32bit_task() ? \
arch/powerpc/kernel/setup-common.c +1 -1
@@ -921,7 +921,7 @@ void __init setup_arch(char **cmdline_p)#ifdef CONFIG_PPC_MM_SLICES #ifdef CONFIG_PPC64 - init_mm.context.addr_limit =TASK_SIZE_128TB ; + init_mm.context.addr_limit =DEFAULT_MAP_WINDOW_USER64 ;#else #error "context.addr_limit not initialized."#endif
arch/powerpc/mm/mmu_context_book3s64.c +1 -1
@@ -99,7 +99,7 @@ static int hash__init_new_context(struct mm_struct *mm)* mm->context.addr_limit. Default to max task size so that we copy the * default values to paca which will help us to handle slb miss early. */ - mm->context.addr_limit =TASK_SIZE_128TB ; + mm->context.addr_limit =DEFAULT_MAP_WINDOW_USER64 ;/* * The old code would re-promote on fork, we don't do that when using
Signature · 1 line
2.7.4
Michael Ellerman
AppliedQuoted 5 lines · Aneesh Kumar K.V
Supporting 512TB requires us to do a order 3 allocation for level 1 page table(pgd). This results in page allocation failures with certain workloads. For now limit 4k linux page size config to 64TB.
Signed-off-by Aneesh Kumar K.V <[email protected]>
Applied to powerpc fixes, thanks.
https://git.kernel.org/powerpc/c/92d9dfda8b547cc292af27e11e11c9
cheers