]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
s390/mm: Allocate page table with PAGE_SIZE granularity
authorSumanth Korikkar <sumanthk@linux.ibm.com>
Mon, 4 Aug 2025 09:57:03 +0000 (11:57 +0200)
committerAlexander Gordeev <agordeev@linux.ibm.com>
Tue, 5 Aug 2025 12:23:20 +0000 (14:23 +0200)
Make vmem_pte_alloc() consistent by always allocating page table of
PAGE_SIZE granularity, regardless of whether page_table_alloc() (with
slab) or memblock_alloc() is used. This ensures page table can be fully
freed when the corresponding page table entries are removed.

Fixes: d08d4e7cd6bf ("s390/mm: use full 4KB page for 2KB PTE")
Reviewed-by: Heiko Carstens <hca@linux.ibm.com>
Reviewed-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Sumanth Korikkar <sumanthk@linux.ibm.com>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
arch/s390/mm/vmem.c

index 448dd6ed1069b7336dd8ed0ab618900b3e46e420..f48ef361bc8315b27efe9bb3b617f55581fb8148 100644 (file)
@@ -64,13 +64,12 @@ void *vmem_crst_alloc(unsigned long val)
 
 pte_t __ref *vmem_pte_alloc(void)
 {
-       unsigned long size = PTRS_PER_PTE * sizeof(pte_t);
        pte_t *pte;
 
        if (slab_is_available())
-               pte = (pte_t *) page_table_alloc(&init_mm);
+               pte = (pte_t *)page_table_alloc(&init_mm);
        else
-               pte = (pte_t *) memblock_alloc(size, size);
+               pte = (pte_t *)memblock_alloc(PAGE_SIZE, PAGE_SIZE);
        if (!pte)
                return NULL;
        memset64((u64 *)pte, _PAGE_INVALID, PTRS_PER_PTE);