Skip to contentSkip to conversation

mm: fixes for THP migration, swap-in and device-private smaps

PATCH Applied Usama Arif 4 participants 15 messages Nov 23 – Nov 25

Subsystems (7)
lore
Share & tools
lore

Usama Arif

author
#0 lore raw

v3 cover mm: fixes for THP migration, swap-in and device-private smaps

This series contains four fixes for existing THP migration, PTE swap-in and smaps paths, plus one cleanup. They were extracted from the work on PMD swap entries for anonymous THPs [1] and can be merged independently.

1. Avoid a folio reference leak when concurrent MADV_DONTNEED clears or splits a migration PMD before the device migration split helper acquires the PMD lock.

2. Prevent PTE swap-in batching from mapping a hardware-poisoned page of a large anon swap-cache folio.

3. Read the PMD once in smaps_pmd_entry(), the way smaps_pte_entry() already does. No functional change.

4. Stop reading the accessed and dirty bits out of a non-present PMD in smaps, where they encode the softleaf entry rather than accessed/dirty state.

5. Account device-private PMDs using mapcounts in smaps, matching the PTE path. Shared mappings get proportional PSS, and exclusive mappings are counted as private.

This applies on top of mm-new (87cdbd9bd631).

v2 -> v3: https://lore.kernel.org/r/[email protected]/
- Patch 2: move the hwpoison check to the top of the batching block, so the two bit tests run before the page table scan rather than after it (David, Zi Yan, Kiryl).
- Patch 3 is new: read the PMD once with pmdp_get(), so patch 4 only has to move pmd_young() and pmd_dirty() under the present branch (Kiryl). Patch 4 is unchanged in effect and keeps its v2 tags.
- Collect the Reviewed-by tags from v2.

v1 -> v2: https://lore.kernel.org/r/[email protected]/
- Patch 2: use the existing folio_contain_hwpoisoned_page()
rather than adding a helper that scans every page of the folio (Lorenzo, David). Only skip batching for anon folios, since falling back for a freshly read folio frees it with the poisoned page in it, and the retried fault can get the same block back.
- Collect the Reviewed-by and Acked-by tags from v1.

[1] PMD-level swap entries for anonymous THPs:
https://lore.kernel.org/r/[email protected]/

Usama Arif (5):
mm/migrate_device: avoid leaking folio references during THP splitting
mm: don't PTE-batch a swap-in of a folio with a hardware-poisoned page fs/proc/task_mmu: read the PMD once in smaps_pmd_entry() fs/proc/task_mmu: don't read young/dirty from a non-present PMD in
smaps
fs/proc/task_mmu: account device-private PMDs as present in smaps

 fs/proc/task_mmu.c  | 21 +++++++++++++--------
 mm/memory.c         |  5 +++++
 mm/migrate_device.c |  7 +------
 3 files changed, 19 insertions(+), 14 deletions(-)
Signature · 1 line
2.53.1-Meta
author
#1 lore raw

PATCH v3 1/5 mm/migrate_device: avoid leaking folio references during THP splitting

migrate_vma_split_unmapped_folio() takes an extra folio reference because split_huge_pmd_address(..., true) drops one when it splits a PMD.

However, migrate_vma only holds mmap_lock for reading. A concurrent MADV_DONTNEED can clear the migration PMD, or split it into PTE migration entries, before the split helper takes the PMD lock. The helper then does nothing and leaves the extra reference behind. folio_split_unmapped() fails with -EAGAIN due to the unexpected reference, and the reference is never dropped, so the source THP is leaked.

If a THP is faulted in at the same address inside that window it is
worse: freeze = true replaces the new folio's mappings with migration entries that nothing will ever remove, and drops a reference the caller never took.

An existing migration PMD is expanded into PTE migration entries even with freeze = false. Use that mode and remove the extra folio_get(). The reference already held by migration keeps the source folio alive whether or not its PMD migration entry still exists.

---
 mm/migrate_device.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
mm/migrate_device.c +1 -6
index 9e19fadfa65c67..3286bb8a4b73ee 100644
@@ -920,12 +920,7 @@ static int migrate_vma_split_unmapped_folio(struct migrate_vma *migrate,
 	unsigned long flags;
 	int ret = 0;
 
-	/*
-	 * take a reference, since split_huge_pmd_address() with freeze = true
-	 * drops a reference at the end.
-	 */
-	folio_get(folio);
-	split_huge_pmd_address(migrate->vma, addr, true);
+	split_huge_pmd_address(migrate->vma, addr, false);
 	ret = folio_split_unmapped(folio, 0);
 	if (ret)
 		return ret;
Signature · 1 line
2.53.1-Meta
maintainer Reviewed-by on v3 1/5
#2 lore raw

Re: [PATCH v3 1/5] mm/migrate_device: avoid leaking folio references during THP splitting

Quoted 20 lines · Usama Arif

migrate_vma_split_unmapped_folio() takes an extra folio reference because split_huge_pmd_address(..., true) drops one when it splits a PMD.

However, migrate_vma only holds mmap_lock for reading. A concurrent MADV_DONTNEED can clear the migration PMD, or split it into PTE migration entries, before the split helper takes the PMD lock. The helper then does nothing and leaves the extra reference behind. folio_split_unmapped() fails with -EAGAIN due to the unexpected reference, and the reference is never dropped, so the source THP is leaked.

If a THP is faulted in at the same address inside that window it is
worse: freeze = true replaces the new folio's mappings with migration entries that nothing will ever remove, and drops a reference the caller never took.

An existing migration PMD is expanded into PTE migration entries even with freeze = false. Use that mode and remove the extra folio_get(). The reference already held by migration keeps the source folio alive whether or not its PMD migration entry still exists.

Quoted 8 lines

LGTM so:

Quoted 23 lines
---
 mm/migrate_device.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
mm/migrate_device.c +1 -7
index 9e19fadfa65c67..3286bb8a4b73ee 100644
@@ -920,12 +920,7 @@ static int migrate_vma_split_unmapped_folio(struct migrate_vma *migrate,
 	unsigned long flags;
 	int ret = 0;
 
-	/*
-	 * take a reference, since split_huge_pmd_address() with freeze = true
-	 * drops a reference at the end.
-	 */
-	folio_get(folio);
-	split_huge_pmd_address(migrate->vma, addr, true);
+	split_huge_pmd_address(migrate->vma, addr, false);
 	ret = folio_split_unmapped(folio, 0);
 	if (ret)
 		return ret;
--
Quoted 2 lines

2.53.1-Meta

--
Cheers, Lorenzo

author
#3 lore raw

PATCH v3 2/5 mm: don't PTE-batch a swap-in of a folio with a hardware-poisoned page

In reply to Usama Arif

do_swap_page() checks PageHWPoison() on the faulting page, but the large-folio batching path then maps the rest of the folio without looking at its other pages. A poisoned page that is not the one being faulted gets mapped anyway, and the fault that would have reported it never happens.

Skip batching for such an anon folio and let each page take its own fault, where the existing check catches it. do_set_pmd() already backs off the same way.

Leave a freshly read folio alone: it is not anon yet and can only be mapped as a whole, and falling back would free it with the poisoned page still in it, which the retried fault can then get back from the page allocator.

Fixes 508758960b8d ("mm: swap: entirely map large folios found in swapcache")
---
 mm/memory.c | 5 +++++
 1 file changed, 5 insertions(+)
mm/memory.c +5 -0
index 282266dd5e5dfa..d7b200e00bce17 100644
@@ -5194,6 +5194,11 @@ vm_fault_t do_swap_page(struct vm_fault *vmf)
 		pte_t *folio_ptep;
 		pte_t folio_pte;
 
+		/* A poisoned page in the folio must take its own fault. */
+		if (folio_test_anon(folio) &&
+		    folio_contain_hwpoisoned_page(folio))
+			goto check_folio;
+
 		folio_pte_range(folio, vma, address, idx, &folio_start,
 				&folio_end);
 		if (unlikely((folio_end - folio_start) >> PAGE_SHIFT != nr))
Signature · 1 line
2.53.1-Meta
maintainer Reviewed-by on v3 2/5
#4 lore raw

Re: [PATCH v3 2/5] mm: don't PTE-batch a swap-in of a folio with a hardware-poisoned page

Quoted 15 lines · Usama Arif

do_swap_page() checks PageHWPoison() on the faulting page, but the large-folio batching path then maps the rest of the folio without looking at its other pages. A poisoned page that is not the one being faulted gets mapped anyway, and the fault that would have reported it never happens.

Skip batching for such an anon folio and let each page take its own fault, where the existing check catches it. do_set_pmd() already backs off the same way.

Leave a freshly read folio alone: it is not anon yet and can only be mapped as a whole, and falling back would free it with the poisoned page still in it, which the retried fault can then get back from the page allocator.

Quoted 6 lines
Fixes 508758960b8d ("mm: swap: entirely map large folios found in swapcache")

Neat! I didn't even know about that function :)

Quoted 21 lines
---
 mm/memory.c | 5 +++++
 1 file changed, 5 insertions(+)
mm/memory.c +5 -1
index 282266dd5e5dfa..d7b200e00bce17 100644
@@ -5194,6 +5194,11 @@ vm_fault_t do_swap_page(struct vm_fault *vmf)
 		pte_t *folio_ptep;
 		pte_t folio_pte;
 
+		/* A poisoned page in the folio must take its own fault. */
+		if (folio_test_anon(folio) &&
+		    folio_contain_hwpoisoned_page(folio))
+			goto check_folio;
+
 		folio_pte_range(folio, vma, address, idx, &folio_start,
 				&folio_end);
 		if (unlikely((folio_end - folio_start) >> PAGE_SHIFT != nr))
--
Quoted 2 lines

2.53.1-Meta

--
Cheers, Lorenzo

author
#5 lore raw

PATCH v3 3/5 fs/proc/task_mmu: read the PMD once in smaps_pmd_entry()

In reply to Usama Arif

smaps_pmd_entry() dereferences the pmd pointer six times. Read it once into a local with pmdp_get(), the way smaps_pte_entry() already does with ptep_get(), so that every test sees the same value.

No functional change intended.

---
 fs/proc/task_mmu.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
fs/proc/task_mmu.c +6 -5
index 540c936aad4714..105c4998eef48f 100644
@@ -1022,14 +1022,15 @@ static void smaps_pmd_entry(pmd_t *pmd, unsigned long addr,
 	struct page *page = NULL;
 	bool present = false;
 	struct folio *folio;
+	pmd_t pmdval = pmdp_get(pmd);
 
-	if (pmd_none(*pmd))
+	if (pmd_none(pmdval))
 		return;
-	if (pmd_present(*pmd)) {
-		page = vm_normal_page_pmd(vma, addr, *pmd);
+	if (pmd_present(pmdval)) {
+		page = vm_normal_page_pmd(vma, addr, pmdval);
 		present = true;
 	} else if (unlikely(thp_migration_supported())) {
-		const softleaf_t entry = softleaf_from_pmd(*pmd);
+		const softleaf_t entry = softleaf_from_pmd(pmdval);
 
 		if (softleaf_has_pfn(entry))
 			page = softleaf_to_page(entry);
@@ -1046,7 +1047,7 @@ static void smaps_pmd_entry(pmd_t *pmd, unsigned long addr,
 	else
 		mss->file_thp += HPAGE_PMD_SIZE;
 
-	smaps_account(mss, page, true, pmd_young(*pmd), pmd_dirty(*pmd),
+	smaps_account(mss, page, true, pmd_young(pmdval), pmd_dirty(pmdval),
 		      locked, present);
 }
 #else
Signature · 1 line
2.53.1-Meta
maintainer Reviewed-by on v3 3/5
#6 lore raw

Re: [PATCH v3 3/5] fs/proc/task_mmu: read the PMD once in smaps_pmd_entry()

Quoted 8 lines · Usama Arif

smaps_pmd_entry() dereferences the pmd pointer six times. Read it once into a local with pmdp_get(), the way smaps_pte_entry() already does with ptep_get(), so that every test sees the same value.

No functional change intended.

LGTM so:

fs/proc/task_mmu.c static void smaps_pmd_entry(pmd_t *pmd, unsigned long addr, · line 1025

Quoted 13 lines
---
 fs/proc/task_mmu.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
fs/proc/task_mmu.c +1 -0
index 540c936aad4714..105c4998eef48f 100644
@@ -1022,14 +1022,15 @@ static void smaps_pmd_entry(pmd_t *pmd, unsigned long addr,
 	struct page *page = NULL;
 	bool present = false;
 	struct folio *folio;
+	pmd_t pmdval = pmdp_get(pmd);

NIT: Can this be const or are the helpers not safe for it?

Quoted 25 lines
fs/proc/task_mmu.c +5 -6
-	if (pmd_none(*pmd))
+	if (pmd_none(pmdval))
 		return;
-	if (pmd_present(*pmd)) {
-		page = vm_normal_page_pmd(vma, addr, *pmd);
+	if (pmd_present(pmdval)) {
+		page = vm_normal_page_pmd(vma, addr, pmdval);
 		present = true;
 	} else if (unlikely(thp_migration_supported())) {
-		const softleaf_t entry = softleaf_from_pmd(*pmd);
+		const softleaf_t entry = softleaf_from_pmd(pmdval);
 
 		if (softleaf_has_pfn(entry))
 			page = softleaf_to_page(entry);
@@ -1046,7 +1047,7 @@ static void smaps_pmd_entry(pmd_t *pmd, unsigned long addr,
 	else
 		mss->file_thp += HPAGE_PMD_SIZE;
 
-	smaps_account(mss, page, true, pmd_young(*pmd), pmd_dirty(*pmd),
+	smaps_account(mss, page, true, pmd_young(pmdval), pmd_dirty(pmdval),
 		      locked, present);
 }
 #else
--
Quoted 2 lines

2.53.1-Meta

--
Cheers, Lorenzo

author
#7 lore raw

Re: [PATCH v3 3/5] fs/proc/task_mmu: read the PMD once in smaps_pmd_entry()

Quoted 5 lines · Lorenzo Stoakes (ARM)
Quoted 4 lines · Usama Arif

smaps_pmd_entry() dereferences the pmd pointer six times. Read it once into a local with pmdp_get(), the way smaps_pte_entry() already does with ptep_get(), so that every test sees the same value.

Quoted 8 lines
Quoted 4 lines

No functional change intended.

LGTM so:

Thanks for the reviews!!

Quoted 5 lines
Quoted 5 lines
---
 fs/proc/task_mmu.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
Quoted 11 lines

fs/proc/task_mmu.c static void smaps_pmd_entry(pmd_t *pmd, unsigned long addr, · line 1025

Quoted 9 lines
fs/proc/task_mmu.c +1 -0
index 540c936aad4714..105c4998eef48f 100644
@@ -1022,14 +1022,15 @@ static void smaps_pmd_entry(pmd_t *pmd, unsigned long addr,
 	struct page *page = NULL;
 	bool present = false;
 	struct folio *folio;
+	pmd_t pmdval = pmdp_get(pmd);

NIT: Can this be const or are the helpers not safe for it?

Ah yes, good point. Its good to have const here.

I think the rest of the series is good to merge. Should I wait a few days and send a new revision with the const change here?

Quoted 31 lines
Quoted 26 lines
fs/proc/task_mmu.c +5 -6
-	if (pmd_none(*pmd))
+	if (pmd_none(pmdval))
 		return;
-	if (pmd_present(*pmd)) {
-		page = vm_normal_page_pmd(vma, addr, *pmd);
+	if (pmd_present(pmdval)) {
+		page = vm_normal_page_pmd(vma, addr, pmdval);
 		present = true;
 	} else if (unlikely(thp_migration_supported())) {
-		const softleaf_t entry = softleaf_from_pmd(*pmd);
+		const softleaf_t entry = softleaf_from_pmd(pmdval);
 
 		if (softleaf_has_pfn(entry))
 			page = softleaf_to_page(entry);
@@ -1046,7 +1047,7 @@ static void smaps_pmd_entry(pmd_t *pmd, unsigned long addr,
 	else
 		mss->file_thp += HPAGE_PMD_SIZE;
 
-	smaps_account(mss, page, true, pmd_young(*pmd), pmd_dirty(*pmd),
+	smaps_account(mss, page, true, pmd_young(pmdval), pmd_dirty(pmdval),
 		      locked, present);
 }
 #else
--
Quoted 2 lines

2.53.1-Meta

--
Cheers, Lorenzo

#8 lore raw

Re: [PATCH v3 3/5] fs/proc/task_mmu: read the PMD once in smaps_pmd_entry()

Quoted 37 lines · Usama Arif
Quoted 5 lines · Lorenzo Stoakes (ARM)
Quoted 4 lines · Usama Arif

smaps_pmd_entry() dereferences the pmd pointer six times. Read it once into a local with pmdp_get(), the way smaps_pte_entry() already does with ptep_get(), so that every test sees the same value.

Quoted 8 lines
Quoted 4 lines

No functional change intended.

LGTM so:

Thanks for the reviews!!

Quoted 5 lines
Quoted 5 lines
---
 fs/proc/task_mmu.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
Quoted 11 lines

fs/proc/task_mmu.c static void smaps_pmd_entry(pmd_t *pmd, unsigned long addr, · line 1025

Quoted 9 lines
fs/proc/task_mmu.c +1 -0
index 540c936aad4714..105c4998eef48f 100644
@@ -1022,14 +1022,15 @@ static void smaps_pmd_entry(pmd_t *pmd, unsigned long addr,
 	struct page *page = NULL;
 	bool present = false;
 	struct folio *folio;
+	pmd_t pmdval = pmdp_get(pmd);

NIT: Can this be const or are the helpers not safe for it?

Quoted 4 lines

Ah yes, good point. Its good to have const here.

I think the rest of the series is good to merge. Should I wait a few days and send a new revision with the const change here?

I'd pick the fist two directly. Can you resend the other 3 such that Andrew can pick them?

Signature · 3 lines
Cheers,

David
author
#9 lore raw

Re: [PATCH v3 3/5] fs/proc/task_mmu: read the PMD once in smaps_pmd_entry()

Quoted 38 lines · On Tue, 24 Nov 2026 09:25:14 +0100 "David Hildenbrand (Arm)"…
Quoted 37 lines · Usama Arif
Quoted 5 lines · Lorenzo Stoakes (ARM)
Quoted 4 lines · Usama Arif

smaps_pmd_entry() dereferences the pmd pointer six times. Read it once into a local with pmdp_get(), the way smaps_pte_entry() already does with ptep_get(), so that every test sees the same value.

Quoted 8 lines
Quoted 4 lines

No functional change intended.

LGTM so:

Thanks for the reviews!!

Quoted 16 lines
Quoted 10 lines
---
 fs/proc/task_mmu.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
fs/proc/task_mmu.c +0 -0
index 540c936aad4714..105c4998eef48f 100644

fs/proc/task_mmu.c static void smaps_pmd_entry(pmd_t *pmd, unsigned long addr, · line 1025

Quoted 4 lines
fs/proc/task_mmu.c +1 -0
@@ -1022,14 +1022,15 @@ static void smaps_pmd_entry(pmd_t *pmd, unsigned long addr,
 	struct page *page = NULL;
 	bool present = false;
 	struct folio *folio;
+	pmd_t pmdval = pmdp_get(pmd);

NIT: Can this be const or are the helpers not safe for it?

Quoted 7 lines
Quoted 4 lines

Ah yes, good point. Its good to have const here.

I think the rest of the series is good to merge. Should I wait a few days and send a new revision with the const change here?

I'd pick the fist two directly. Can you resend the other 3 such that Andrew can pick them?

Will do! Thanks for picking them up!

Quoted 6 lines
Signature · 4 lines
-- 
Cheers,

David
reviewer Reviewed-by on v3 3/5
#10 lore raw

Re: [PATCH v3 3/5] fs/proc/task_mmu: read the PMD once in smaps_pmd_entry()

In reply to Usama Arif
Quoted 4 lines · Usama Arif

smaps_pmd_entry() dereferences the pmd pointer six times. Read it once into a local with pmdp_get(), the way smaps_pte_entry() already does with ptep_get(), so that every test sees the same value.

Quoted 8 lines

No functional change intended.

---
 fs/proc/task_mmu.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

Makes sense.

Best Regards,
Yan, Zi

author
#11 lore raw

PATCH v3 4/5 fs/proc/task_mmu: don't read young/dirty from a non-present PMD in smaps

In reply to Usama Arif

smaps_pmd_entry() passes pmd_young() and pmd_dirty() to smaps_account() for every PMD, including softleaf entries (migration and device-private), where those bits encode the entry rather than accessed/dirty state. smaps_pte_entry() only reads them when the entry is present.

On x86_64 the entry's offset is stored inverted across bits 9-58, which overlap _PAGE_SAVED_DIRTY, so pmd_dirty() returns garbage: a clean 2MB device-private mapping is accounted as 2048 kB dirty, and lazyfree accounting is suppressed. pgtable_64.h also warns that the hardware can set the accessed and dirty bits on non-present entries by mistake.

Only read the bits when the PMD is present.

Fixes c94b6923fa0a ("/proc/PID/smaps: Add PMD migration entry parsing")
---
 fs/proc/task_mmu.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
fs/proc/task_mmu.c +4 -3
index 105c4998eef48f..34aaf80cd46cc2 100644
@@ -1020,7 +1020,7 @@ static void smaps_pmd_entry(pmd_t *pmd, unsigned long addr,
 	struct vm_area_struct *vma = walk->vma;
 	bool locked = !!(vma->vm_flags & VM_LOCKED);
 	struct page *page = NULL;
-	bool present = false;
+	bool present = false, young = false, dirty = false;
 	struct folio *folio;
 	pmd_t pmdval = pmdp_get(pmd);
 
@@ -1028,6 +1028,8 @@ static void smaps_pmd_entry(pmd_t *pmd, unsigned long addr,
 		return;
 	if (pmd_present(pmdval)) {
 		page = vm_normal_page_pmd(vma, addr, pmdval);
+		young = pmd_young(pmdval);
+		dirty = pmd_dirty(pmdval);
 		present = true;
 	} else if (unlikely(thp_migration_supported())) {
 		const softleaf_t entry = softleaf_from_pmd(pmdval);
@@ -1047,8 +1049,7 @@ static void smaps_pmd_entry(pmd_t *pmd, unsigned long addr,
 	else
 		mss->file_thp += HPAGE_PMD_SIZE;
 
-	smaps_account(mss, page, true, pmd_young(pmdval), pmd_dirty(pmdval),
-		      locked, present);
+	smaps_account(mss, page, true, young, dirty, locked, present);
 }
 #else
 static void smaps_pmd_entry(pmd_t *pmd, unsigned long addr,
Signature · 1 line
2.53.1-Meta
author
#12 lore raw

PATCH v3 5/5 fs/proc/task_mmu: account device-private PMDs as present in smaps

In reply to Usama Arif

Device-private PMDs represent mapped pages, but smaps_pmd_entry() passes present=false to smaps_account(). That treats them like migration
entries: mapcounts are ignored, PSS is charged in full, and exclusive mappings are accounted as shared.

Match smaps_pte_entry() and mark device-private PMDs as present so smaps_account() uses mapcounts for PSS and private/shared accounting.

Fixes a30b48bf1b24 ("mm/migrate_device: implement THP migration of zone device pages")
---
 fs/proc/task_mmu.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
fs/proc/task_mmu.c +4 -1
index 34aaf80cd46cc2..fd32840a8cd7c3 100644
@@ -1034,8 +1034,11 @@ static void smaps_pmd_entry(pmd_t *pmd, unsigned long addr,
 	} else if (unlikely(thp_migration_supported())) {
 		const softleaf_t entry = softleaf_from_pmd(pmdval);
 
-		if (softleaf_has_pfn(entry))
+		if (softleaf_has_pfn(entry)) {
+			if (softleaf_is_device_private(entry))
+				present = true;
 			page = softleaf_to_page(entry);
+		}
 	}
 	if (IS_ERR_OR_NULL(page))
 		return;
Signature · 1 line
2.53.1-Meta
maintainer Applied
#13 lore raw

Re: (subset) [PATCH v3 0/5] mm: fixes for THP migration, swap-in and device-private smaps

In reply to Usama Arif
Quoted 9 lines · Usama Arif

This series contains four fixes for existing THP migration, PTE swap-in and smaps paths, plus one cleanup. They were extracted from the work on PMD swap entries for anonymous THPs [1] and can be merged independently.

1. Avoid a folio reference leak when concurrent MADV_DONTNEED clears or splits a migration PMD before the device migration split helper acquires the PMD lock.

[...]

Applied, thanks!

tree: mm/core.git
branch: migrate-7.5.misc

Applied patches will appear soon in mm-next, followed by linux-next.

Please report any outstanding bugs that were missed during review, so we can either drop the patch series or decide how to fix it up.

It is encouraged to provide Acked-bys, Reviewed-bys, and Tested-bys even though the patches have already been applied. If possible, patch trailers will be updated.

Note that commit hashes shown below are subject to change due to rebase, trailer updates or similar. Further, this is not a guarantee that the patches will go upstream. If in doubt, please check the listed branch.

[1/5] mm/migrate_device: avoid leaking folio references during THP splitting

      https://git.kernel.org/mm/core/c/62541fb6
Signature · 3 lines
Cheers,

David
maintainer Applied
#14 lore raw

Re: (subset) [PATCH v3 0/5] mm: fixes for THP migration, swap-in and device-private smaps

In reply to Usama Arif
Quoted 9 lines · Usama Arif

This series contains four fixes for existing THP migration, PTE swap-in and smaps paths, plus one cleanup. They were extracted from the work on PMD swap entries for anonymous THPs [1] and can be merged independently.

1. Avoid a folio reference leak when concurrent MADV_DONTNEED clears or splits a migration PMD before the device migration split helper acquires the PMD lock.

[...]

Applied, thanks!

tree: mm/core.git
branch: core-7.5.misc

Applied patches will appear soon in mm-next, followed by linux-next.

Please report any outstanding bugs that were missed during review, so we can either drop the patch series or decide how to fix it up.

It is encouraged to provide Acked-bys, Reviewed-bys, and Tested-bys even though the patches have already been applied. If possible, patch trailers will be updated.

Note that commit hashes shown below are subject to change due to rebase, trailer updates or similar. Further, this is not a guarantee that the patches will go upstream. If in doubt, please check the listed branch.

[2/5] mm: don't PTE-batch a swap-in of a folio with a hardware-poisoned page

      https://git.kernel.org/mm/core/c/37d4eb7d
Signature · 3 lines
Cheers,

David