Skip to content

Commit 90888b4

Browse files
ljskernelakpm00
authored andcommitted
mm: remove unnecessary and incorrect mmap lock assert
This check was introduced by commit 42fc541 ("mmap locking API: add mmap_assert_locked() and mmap_assert_write_locked()") which replaced a VM_BUG_ON_VMA() over rwsem_is_locked from commit a00cc7d ("mm, x86: add support for PUD-sized transparent hugepages"), i.e. the commit that introduced PUD THPs. These seem to be careful asserts introduced to ensure that locks are held in general, however for a zap we require that VMAs are kept stable, and this is a requirement that has held perfectly well for a long time. These were long before VMA locks and thus there appears to be no reason to think this is assert is there for anything other than 'stabilised VMA'. Asserting that the VMA under examination is stable only in the case of a THP PUD is strange and unnecessary. If we wish to be careful and assert such things, we should do so at the zap level. However in any case the current situation is already simply incorrect - a VMA lock suffices here. Remove the assert for now as it is unnecessarily, incorrect and unhelpful, subsequent work can introduce an assert in general for zapping if required. Link: https://lkml.kernel.org/r/20260114115619.1087466-1-lorenzo.stoakes@oracle.com Fixes: 2ab7f1b ("mm/madvise: allow guard page install/remove under VMA lock") Signed-off-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com> Reported-by: Chris Mason <clm@meta.com> Closes: https://lore.kernel.org/all/20260113220856.2358195-1-clm@meta.com/ Acked-by: David Hildenbrand (Red Hat) <david@kernel.org> Cc: Liam Howlett <liam.howlett@oracle.com> Cc: Michal Hocko <mhocko@suse.com> Cc: Mike Rapoport <rppt@kernel.org> Cc: SeongJae Park <sj@kernel.org> Cc: Suren Baghdasaryan <surenb@google.com> Cc: Vlastimil Babka <vbabka@suse.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent b505f19 commit 90888b4

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

mm/memory.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1963,10 +1963,9 @@ static inline unsigned long zap_pud_range(struct mmu_gather *tlb,
19631963
do {
19641964
next = pud_addr_end(addr, end);
19651965
if (pud_trans_huge(*pud)) {
1966-
if (next - addr != HPAGE_PUD_SIZE) {
1967-
mmap_assert_locked(tlb->mm);
1966+
if (next - addr != HPAGE_PUD_SIZE)
19681967
split_huge_pud(vma, pud, addr);
1969-
} else if (zap_huge_pud(tlb, vma, pud, addr))
1968+
else if (zap_huge_pud(tlb, vma, pud, addr))
19701969
goto next;
19711970
/* fall through */
19721971
}

0 commit comments

Comments
 (0)