Skip to contentSkip to conversation

mm-rmap-add-try_to_unmap_poisoned_hugetlb_one.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message Aug 5

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: mm/rmap: add try_to_unmap_poisoned_hugetlb_one
has been removed from the -mm tree. Its filename was
mm-rmap-add-try_to_unmap_poisoned_hugetlb_one.patch

This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Dev Jain <[email protected]>
Subject: mm/rmap: add try_to_unmap_poisoned_hugetlb_one
Date: Thu, 30 Jul 2026 09:45:53 +0000

Simplify try_to_unmap_one() by separating the hugetlb parts into try_to_unmap_poisoned_hugetlb_one().

To understand the correctness of the refactoring, the following points are noted:

1. try_to_unmap() is called for hugetlb folios only when they are hwpoisoned.

2. A hugetlb VMA cannot be mlocked.

3. page_vma_mapped_walk() returns at most one hugetlb mapping in a VMA, and that mapping points at the head PFN.

4. We won't ever process a softleaf entry that encodes a hugetlb folio; hugetlb folios are never swapped out, migration entries will be skipped (PVMW_MIGRATION not passed), and device-exclusive does not work for hugetlb.

5. The hwpoison entry is constructed from the poisoned folio, just as in the pre-refactor code. Any previous uffd-wp state is deliberately not preserved for the hwpoison entry.

6. TTU_HWPOISON is always present; for it to not be present, either the folio has to be in swapcache, or mapping_can_writeback() is true (see unmap_poisoned_folio), none of which is true for hugetlb folios.

7. Hugetlb uses separate counters from normal rss counters, therefore update_highwater_rss() need not be called.

While at it:

- Change VM_BUG_* to VM_WARN_*.

- Do not declare variables which are only used once.

- Constify some variables.

- Add some more VM_WARN_* to assert some invariants.

Except the above 4 points, no functional change intended.

---

 include/linux/hugetlb.h |    1 
 mm/rmap.c               |  180 ++++++++++++++++++++------------------
 2 files changed, 98 insertions(+), 83 deletions(-)
include/linux/hugetlb.h renamed from include/linux/hugetlb.h~mm-rmap-add-try_to_unmap_poisoned_hugetlb_one +1 -0
@@ -1270,6 +1270,7 @@ static inline void hugetlb_count_sub(lon
 }
 
 pte_t huge_ptep_get(struct mm_struct *mm, unsigned long addr, pte_t *ptep);
+unsigned long huge_pte_dirty(pte_t pte);
 
 static inline pte_t huge_ptep_clear_flush(struct vm_area_struct *vma,
 					  unsigned long addr, pte_t *ptep)
mm/rmap.c renamed from mm/rmap.c~mm-rmap-add-try_to_unmap_poisoned_hugetlb_one +97 -83

236 lines not on this page · raw message

_

Patches currently in -mm which might be from [email protected] are

mm-memory-move-pte_install_uffd_wp_if_needed-into-memoryc.patch mm-memory-batch-set-uffd-wp-markers-during-zapping.patch mm-rmap-batch-unmap-file-folios-belonging-to-uffd-wp-vmas.patch