Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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.

Fixes: f6eedbba7a26 ("powerpc/mm/hash: Increase VA range to 128TB")
Reported-by: Hugh Dickins <hughd@google.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>

authored by

Aneesh Kumar K.V and committed by
Michael Ellerman
92d9dfda cec422c1

+15 -16
+1 -1
arch/powerpc/include/asm/book3s/64/hash-4k.h
··· 8 8 #define H_PTE_INDEX_SIZE 9 9 9 #define H_PMD_INDEX_SIZE 7 10 10 #define H_PUD_INDEX_SIZE 9 11 - #define H_PGD_INDEX_SIZE 12 11 + #define H_PGD_INDEX_SIZE 9 12 12 13 13 #ifndef __ASSEMBLY__ 14 14 #define H_PTE_TABLE_SIZE (sizeof(pte_t) << H_PTE_INDEX_SIZE)
+12 -13
arch/powerpc/include/asm/processor.h
··· 110 110 #define TASK_SIZE_128TB (0x0000800000000000UL) 111 111 #define TASK_SIZE_512TB (0x0002000000000000UL) 112 112 113 - #ifdef CONFIG_PPC_BOOK3S_64 113 + /* 114 + * For now 512TB is only supported with book3s and 64K linux page size. 115 + */ 116 + #if defined(CONFIG_PPC_BOOK3S_64) && defined(CONFIG_PPC_64K_PAGES) 114 117 /* 115 118 * Max value currently used: 116 119 */ 117 - #define TASK_SIZE_USER64 TASK_SIZE_512TB 120 + #define TASK_SIZE_USER64 TASK_SIZE_512TB 121 + #define DEFAULT_MAP_WINDOW_USER64 TASK_SIZE_128TB 118 122 #else 119 - #define TASK_SIZE_USER64 TASK_SIZE_64TB 123 + #define TASK_SIZE_USER64 TASK_SIZE_64TB 124 + #define DEFAULT_MAP_WINDOW_USER64 TASK_SIZE_64TB 120 125 #endif 121 126 122 127 /* ··· 137 132 * space during mmap's. 138 133 */ 139 134 #define TASK_UNMAPPED_BASE_USER32 (PAGE_ALIGN(TASK_SIZE_USER32 / 4)) 140 - #define TASK_UNMAPPED_BASE_USER64 (PAGE_ALIGN(TASK_SIZE_128TB / 4)) 135 + #define TASK_UNMAPPED_BASE_USER64 (PAGE_ALIGN(DEFAULT_MAP_WINDOW_USER64 / 4)) 141 136 142 137 #define TASK_UNMAPPED_BASE ((is_32bit_task()) ? \ 143 138 TASK_UNMAPPED_BASE_USER32 : TASK_UNMAPPED_BASE_USER64 ) ··· 148 143 * with 128TB and conditionally enable upto 512TB 149 144 */ 150 145 #ifdef CONFIG_PPC_BOOK3S_64 151 - #define DEFAULT_MAP_WINDOW ((is_32bit_task()) ? \ 152 - TASK_SIZE_USER32 : TASK_SIZE_128TB) 146 + #define DEFAULT_MAP_WINDOW ((is_32bit_task()) ? \ 147 + TASK_SIZE_USER32 : DEFAULT_MAP_WINDOW_USER64) 153 148 #else 154 149 #define DEFAULT_MAP_WINDOW TASK_SIZE 155 150 #endif 156 151 157 152 #ifdef __powerpc64__ 158 153 159 - #ifdef CONFIG_PPC_BOOK3S_64 160 - /* Limit stack to 128TB */ 161 - #define STACK_TOP_USER64 TASK_SIZE_128TB 162 - #else 163 - #define STACK_TOP_USER64 TASK_SIZE_USER64 164 - #endif 165 - 154 + #define STACK_TOP_USER64 DEFAULT_MAP_WINDOW_USER64 166 155 #define STACK_TOP_USER32 TASK_SIZE_USER32 167 156 168 157 #define STACK_TOP (is_32bit_task() ? \
+1 -1
arch/powerpc/kernel/setup-common.c
··· 928 928 929 929 #ifdef CONFIG_PPC_MM_SLICES 930 930 #ifdef CONFIG_PPC64 931 - init_mm.context.addr_limit = TASK_SIZE_128TB; 931 + init_mm.context.addr_limit = DEFAULT_MAP_WINDOW_USER64; 932 932 #else 933 933 #error "context.addr_limit not initialized." 934 934 #endif
+1 -1
arch/powerpc/mm/mmu_context_book3s64.c
··· 99 99 * mm->context.addr_limit. Default to max task size so that we copy the 100 100 * default values to paca which will help us to handle slb miss early. 101 101 */ 102 - mm->context.addr_limit = TASK_SIZE_128TB; 102 + mm->context.addr_limit = DEFAULT_MAP_WINDOW_USER64; 103 103 104 104 /* 105 105 * The old code would re-promote on fork, we don't do that when using