diff options
author | Heiko Carstens <hca@linux.ibm.com> | 2025-04-30 10:59:30 +0200 |
---|---|---|
committer | Heiko Carstens <hca@linux.ibm.com> | 2025-05-05 15:47:20 +0200 |
commit | f049a4f7ffa50000485a61d5518ffae24b662aaa (patch) | |
tree | e68f0be0aad6993dbdcbded76f29056b1d90b868 | |
parent | de6b4f99010ad22f0242f1fc0f75c0752a56e9bb (diff) |
s390/mm: Add mmap_assert_write_locked() check to crst_table_upgrade()
Add mmap_assert_write_locked() check to crst_table_upgrade() in order to
verify that no concurrent page table upgrades of an mm can happen. This
allows to remove the VM_BUG_ON() check which checks for the potential
inconsistent result of concurrent updates.
Reviewed-by: Gerald Schaefer <gerald.schaefer@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
-rw-r--r-- | arch/s390/mm/pgalloc.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/arch/s390/mm/pgalloc.c b/arch/s390/mm/pgalloc.c index 9470280831d8..e33903b419a9 100644 --- a/arch/s390/mm/pgalloc.c +++ b/arch/s390/mm/pgalloc.c @@ -56,6 +56,8 @@ int crst_table_upgrade(struct mm_struct *mm, unsigned long end) unsigned long *pgd = NULL, *p4d = NULL, *__pgd; unsigned long asce_limit = mm->context.asce_limit; + mmap_assert_write_locked(mm); + /* upgrade should only happen from 3 to 4, 3 to 5, or 4 to 5 levels */ VM_BUG_ON(asce_limit < _REGION2_SIZE); @@ -79,13 +81,6 @@ int crst_table_upgrade(struct mm_struct *mm, unsigned long end) spin_lock_bh(&mm->page_table_lock); - /* - * This routine gets called with mmap_lock lock held and there is - * no reason to optimize for the case of otherwise. However, if - * that would ever change, the below check will let us know. - */ - VM_BUG_ON(asce_limit != mm->context.asce_limit); - if (p4d) { __pgd = (unsigned long *) mm->pgd; p4d_populate(mm, (p4d_t *) p4d, (pud_t *) __pgd); |