Skip to content

Commit 502269a

Browse files
Alexander Gordeevakpm00
authored andcommitted
s390/mm: add missing ctor/dtor on page table upgrade
Commit 78966b550289 ("s390: pgtable: add statistics for PUD and P4D level page table") misses the call to pagetable_p4d_ctor() against a newly allocated P4D table in crst_table_upgrade(); Commit 68c601de75d8 ("mm: introduce ctor/dtor at PGD level") misses the call to pagetable_pgd_ctor() against a newly allocated PGD and the call to pagetable_dtor() against a newly allocated P4D that is about to be freed on crst_table_upgrade() PGD upgrade fail path. The missed constructors and destructor break (at least) the page table accounting when a process memory space is upgraded. Link: https://lkml.kernel.org/r/[email protected] Fixes: 78966b550289 ("s390: pgtable: add statistics for PUD and P4D level page table") Fixes: 68c601de75d8 ("mm: introduce ctor/dtor at PGD level") Signed-off-by: Alexander Gordeev <[email protected]> Reported-by: Heiko Carstens <[email protected]> Closes: https://lore.kernel.org/all/[email protected]/ Suggested-by: Heiko Carstens <[email protected]> Reviewed-by: Gerald Schaefer <[email protected]> Acked-by: Qi Zheng <[email protected]> Reviewed-by: Kevin Brodsky <[email protected]> Cc: Heiko Carstens <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 0e81f6e commit 502269a

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

arch/s390/mm/pgalloc.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,14 @@ int crst_table_upgrade(struct mm_struct *mm, unsigned long end)
8888
if (unlikely(!p4d))
8989
goto err_p4d;
9090
crst_table_init(p4d, _REGION2_ENTRY_EMPTY);
91+
pagetable_p4d_ctor(virt_to_ptdesc(p4d));
9192
}
9293
if (end > _REGION1_SIZE) {
9394
pgd = crst_table_alloc(mm);
9495
if (unlikely(!pgd))
9596
goto err_pgd;
9697
crst_table_init(pgd, _REGION1_ENTRY_EMPTY);
98+
pagetable_pgd_ctor(virt_to_ptdesc(pgd));
9799
}
98100

99101
spin_lock_bh(&mm->page_table_lock);
@@ -130,6 +132,7 @@ int crst_table_upgrade(struct mm_struct *mm, unsigned long end)
130132
return 0;
131133

132134
err_pgd:
135+
pagetable_dtor(virt_to_ptdesc(p4d));
133136
crst_table_free(mm, p4d);
134137
err_p4d:
135138
return -ENOMEM;

0 commit comments

Comments
 (0)