Skip to content

Commit 1442bb8

Browse files
Vasily Gorbikhcahca
authored andcommitted
s390/boot: Use entire page for PTEs
Make boot_pte_alloc() always allocate a full PAGE_SIZE page for PTE tables, instead of carving two 2K PTE tables out of a single 4K page, similar to commit daa8af8 ("s390/mm: Allocate page table with PAGE_SIZE granularity"). This mirrors the change in the vmem code and ensures that boot page tables backing the early KASAN shadow can later be fully freed by the vmem page-table teardown helpers (e.g. when unmapping early KASAN shadow on memory hotplug). The leftover-based allocation was originally added to reduce physmem allocator fragmentation when EDAT was disabled. On current hardware EDAT1 is available on all production systems, so the complexity is no longer justified and gets in the way of freeing the shadow mappings. Signed-off-by: Vasily Gorbik <gor@linux.ibm.com> Reviewed-by: Heiko Carstens <hca@linux.ibm.com> Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
1 parent d9f5917 commit 1442bb8

1 file changed

Lines changed: 2 additions & 14 deletions

File tree

arch/s390/boot/vmem.c

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -244,22 +244,10 @@ static void *boot_crst_alloc(unsigned long val)
244244

245245
static pte_t *boot_pte_alloc(void)
246246
{
247-
static void *pte_leftover;
248247
pte_t *pte;
249248

250-
/*
251-
* handling pte_leftovers this way helps to avoid memory fragmentation
252-
* during POPULATE_KASAN_MAP_SHADOW when EDAT is off
253-
*/
254-
if (!pte_leftover) {
255-
pte_leftover = (void *)physmem_alloc_or_die(RR_VMEM, PAGE_SIZE, PAGE_SIZE);
256-
pte = pte_leftover + _PAGE_TABLE_SIZE;
257-
__arch_set_page_dat(pte, 1);
258-
} else {
259-
pte = pte_leftover;
260-
pte_leftover = NULL;
261-
}
262-
249+
pte = (void *)physmem_alloc_or_die(RR_VMEM, PAGE_SIZE, PAGE_SIZE);
250+
__arch_set_page_dat(pte, 1);
263251
memset64((u64 *)pte, _PAGE_INVALID, PTRS_PER_PTE);
264252
return pte;
265253
}

0 commit comments

Comments
 (0)