diff options
| author | Nico Pache <npache@redhat.com> | 2026-05-26 05:54:04 -0600 |
|---|---|---|
| committer | Andrew Morton <akpm@linux-foundation.org> | 2026-05-28 21:31:34 -0700 |
| commit | ce635051c9f68fa42e2e2597ddfc20e68df95117 (patch) | |
| tree | 95da3e11f367889885059f412c59ad18fe20603d /mm | |
| parent | 5c38bcfa40af544c2d88dad4d0dc6534487e7fe8 (diff) | |
| download | linux-next-history-ce635051c9f68fa42e2e2597ddfc20e68df95117.tar.gz | |
add a clarifying comment and change warn_on
Add a clarifying comment describing how the locking/mmu notifier is
handled and change the WARN_ON_ONCE to VM_WARN_ON_ONCE per davids
suggestion.
Link: https://lore.kernel.org/a48032dd-7881-43c0-b439-5cda6124ea58@redhat.com
Signed-off-by: Nico Pache <npache@redhat.com>
Acked-by: David Hildenbrand (arm) <david@kernel.org>
Cc: Lorenzo Stoakes <ljs@kernel.org>
Cc: Zi Yan <ziy@nvidia.com>
Cc: Baolin Wang <baolin.wang@linux.alibaba.com>
Cc: "Liam R. Howlett" <liam@infradead.org>
Cc: Nico Pache <npache@redhat.com>
Cc: Ryan Roberts <ryan.roberts@arm.com>
Cc: Dev Jain <dev.jain@arm.com>
Cc: Barry Song <baohua@kernel.org>
Cc: Lance Yang <lance.yang@linux.dev>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'mm')
| -rw-r--r-- | mm/khugepaged.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/mm/khugepaged.c b/mm/khugepaged.c index 89718734015bf..a5e9842392eaf 100644 --- a/mm/khugepaged.c +++ b/mm/khugepaged.c @@ -1286,6 +1286,13 @@ static enum scan_result collapse_huge_page(struct mm_struct *mm, unsigned long s anon_vma_lock_write(vma->anon_vma); anon_vma_locked = true; + /* + * Only notify about the PTE range we will actually modify. While we + * temporary unmap the whole PTE table for mTHP collapse, we'll remap + * it later, leaving other PTEs effectively unmodified. The locks we + * hold prevent anybody from stumbling over such temporarily unmapped + * PTE tables. + */ mmu_notifier_range_init(&range, MMU_NOTIFY_CLEAR, 0, mm, start_addr, end_addr); mmu_notifier_invalidate_range_start(&range); @@ -1351,7 +1358,7 @@ static enum scan_result collapse_huge_page(struct mm_struct *mm, unsigned long s */ __folio_mark_uptodate(folio); spin_lock(pmd_ptl); - WARN_ON_ONCE(!pmd_none(*pmd)); + VM_WARN_ON_ONCE(!pmd_none(*pmd)); if (is_pmd_order(order)) { pgtable = pmd_pgtable(_pmd); pgtable_trans_huge_deposit(mm, pmd, pgtable); |
