From b6577b7604810030b5df09106f713e998ad24ea9 Mon Sep 17 00:00:00 2001 From: Kalesh Singh Date: Tue, 18 Jun 2024 00:10:48 +0000 Subject: [PATCH] ANDROID: 16K: Avoid mmap lock assertions for padding VMAs The padding VMA is never inserted into the VMA tree; therefore we don't need to have the mmap lock in exclusive mode to modify it. Test: v2/android-gki/ack_platform_integration_main_cf_arm64_boot_test on kernel_virt_debug_aarch64 Bug: 346741763 Bug: 352463814 Change-Id: I4ca3ed22dab45b6bb895cb41c5c6792344188b61 Signed-off-by: Kalesh Singh (cherry picked from commit a8b3ebe7f90afe0ad0d9a8b0b90f266da06a7007) --- mm/pgsize_migration.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/mm/pgsize_migration.c b/mm/pgsize_migration.c index ebdf1077d2d3..bca3c4aca982 100644 --- a/mm/pgsize_migration.c +++ b/mm/pgsize_migration.c @@ -294,11 +294,14 @@ struct vm_area_struct *get_pad_vma(struct vm_area_struct *vma) /* Adjust the start to begin at the start of the padding section */ pad->vm_start = VMA_PAD_START(pad); + /* + * The below modifications to vm_flags don't need mmap write lock, + * since, pad does not belong to the VMA tree. + */ /* Make the pad vma PROT_NONE */ - vm_flags_clear(pad, VM_READ|VM_WRITE|VM_EXEC); - + __vm_flags_mod(pad, 0, VM_READ|VM_WRITE|VM_EXEC); /* Remove padding bits */ - vm_flags_clear(pad, VM_PAD_MASK); + __vm_flags_mod(pad, 0, VM_PAD_MASK); return pad; }