Skip to content

Commit

Permalink
s390/mm: Add mmap_assert_write_locked() check to crst_table_upgrade()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Heiko Carstens committed May 5, 2025
1 parent de6b4f9 commit f049a4f
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions arch/s390/mm/pgalloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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);
Expand Down

0 comments on commit f049a4f

Please sign in to comment.