Skip to contentSkip to conversation

mm/migrate_device: pin large folios before splitting

PATCH In review Usama Arif 7 participants 12 messages Jul 1 – Jul 2

Subsystems (2)
lore
Share & tools
lore

Usama Arif

author
#0 lore raw

PATCH 1/1 mm/migrate_device: pin large folios before splitting

migrate_vma_collect_pmd() can detect a large folio while holding the PTE lock, then drop the PTE lock before calling migrate_vma_split_folio(). The split helper took its own reference, but only after the lock had already been dropped.

One way to hit this is device migration over a range that contains a large folio. The walker reads the PTE while holding the PTE lock and derives the folio either from a present PTE via vm_normal_page(), or from a non-present PTE that encodes a device-private softleaf entry. It then has to drop the PTE lock because split_folio() can block. Before migrate_vma_split_folio() gets a folio reference, concurrent reclaim, migration, or truncation can replace or clear the entry and drop the last reference to the folio. The split helper would then take a reference and lock on a stale folio pointer.

Take a temporary reference before dropping the PTE lock and pass that reference into migrate_vma_split_folio(). The helper consumes the reference, so split_folio() still sees only the expected caller pin instead of an extra pin that could make the split fail.

Fixes 022a12deda53 ("mm/migrate_device: handle partially mapped folios during collection")
---
 mm/migrate_device.c | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)
mm/migrate_device.c +18 -3
index 2f8b646302c2..f5a5f699e98e 100644
@@ -77,6 +77,9 @@ static int migrate_vma_collect_hole(unsigned long start,
  * @folio: the folio to split
  * @fault_page: struct page associated with the fault if any
  *
+ * If @folio is not the folio containing @fault_page, the caller must hold a
+ * reference on @folio. The helper consumes that reference.
+ *
  * Returns 0 on success
  */
 static int migrate_vma_split_folio(struct folio *folio,
@@ -86,10 +89,8 @@ static int migrate_vma_split_folio(struct folio *folio,
 	struct folio *fault_folio = fault_page ? page_folio(fault_page) : NULL;
 	struct folio *new_fault_folio = NULL;
 
-	if (folio != fault_folio) {
-		folio_get(folio);
+	if (folio != fault_folio)
 		folio_lock(folio);
-	}
 
 	ret = split_folio(folio);
 	if (ret) {
@@ -310,6 +311,13 @@ static int migrate_vma_collect_pmd(pmd_t *pmdp,
 			if (folio_test_large(folio)) {
 				int ret;
 
+				/*
+				 * Keep the folio stable after dropping the PTE
+				 * lock. migrate_vma_split_folio() consumes this
+				 * reference.
+				 */
+				if (folio != fault_folio)
+					folio_get(folio);
 				lazy_mmu_mode_disable();
 				pte_unmap_unlock(ptep, ptl);
 				ret = migrate_vma_split_folio(folio,
@@ -353,6 +361,13 @@ static int migrate_vma_collect_pmd(pmd_t *pmdp,
 			if (folio && folio_test_large(folio)) {
 				int ret;
 
+				/*
+				 * Keep the folio stable after dropping the
+				 * PTE lock. migrate_vma_split_folio() consumes
+				 * this reference.
+				 */
+				if (folio != fault_folio)
+					folio_get(folio);
 				lazy_mmu_mode_disable();
 				pte_unmap_unlock(ptep, ptl);
 				ret = migrate_vma_split_folio(folio,
Signature · 1 line
2.53.0-Meta
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 54 lines · Usama Arif

migrate_vma_collect_pmd() can detect a large folio while holding the PTE lock, then drop the PTE lock before calling migrate_vma_split_folio(). The split helper took its own reference, but only after the lock had already been dropped.

One way to hit this is device migration over a range that contains a large folio. The walker reads the PTE while holding the PTE lock and derives the folio either from a present PTE via vm_normal_page(), or from a non-present PTE that encodes a device-private softleaf entry. It then has to drop the PTE lock because split_folio() can block. Before migrate_vma_split_folio() gets a folio reference, concurrent reclaim, migration, or truncation can replace or clear the entry and drop the last reference to the folio. The split helper would then take a reference and lock on a stale folio pointer.

Take a temporary reference before dropping the PTE lock and pass that reference into migrate_vma_split_folio(). The helper consumes the reference, so split_folio() still sees only the expected caller pin instead of an extra pin that could make the split fail.

Fixes 022a12deda53 ("mm/migrate_device: handle partially mapped folios during collection")
---
 mm/migrate_device.c | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)
mm/migrate_device.c +4 -3
index 2f8b646302c2..f5a5f699e98e 100644
@@ -77,6 +77,9 @@ static int migrate_vma_collect_hole(unsigned long start,
  * @folio: the folio to split
  * @fault_page: struct page associated with the fault if any
  *
+ * If @folio is not the folio containing @fault_page, the caller must hold a
+ * reference on @folio. The helper consumes that reference.
+ *
  * Returns 0 on success
  */
 static int migrate_vma_split_folio(struct folio *folio,
@@ -86,10 +89,8 @@ static int migrate_vma_split_folio(struct folio *folio,
 	struct folio *fault_folio = fault_page ? page_folio(fault_page) : NULL;
 	struct folio *new_fault_folio = NULL;
 
-	if (folio != fault_folio) {
-		folio_get(folio);
+	if (folio != fault_folio)
 		folio_lock(folio);
-	}
 
 	ret = split_folio(folio);
 	if (ret) {

mm/migrate_device.c static int migrate_vma_collect_pmd(pmd_t *pmdp, · line 318

Quoted 8 lines
mm/migrate_device.c +5 -0
@@ -310,6 +311,13 @@ static int migrate_vma_collect_pmd(pmd_t *pmdp,
 			if (folio_test_large(folio)) {
 				int ret;
 
+				/*
+				 * Keep the folio stable after dropping the PTE
+				 * lock. migrate_vma_split_folio() consumes this
+				 * reference.
+				 */

Do we really need that comment (same below?). It's a common mechanism when keeping to refer to folios after dropping the PTL.

Quoted 9 lines
mm/migrate_device.c +2 -0
+				if (folio != fault_folio)
+					folio_get(folio);
 				lazy_mmu_mode_disable();
 				pte_unmap_unlock(ptep, ptl);
 				ret = migrate_vma_split_folio(folio,
@@ -353,6 +361,13 @@ static int migrate_vma_collect_pmd(pmd_t *pmdp,
 			if (folio && folio_test_large(folio)) {
 				int ret;
 

mm/migrate_device.c static int migrate_vma_collect_pmd(pmd_t *pmdp, · line 373

Quoted 10 lines
mm/migrate_device.c +7 -0
+				/*
+				 * Keep the folio stable after dropping the
+				 * PTE lock. migrate_vma_split_folio() consumes
+				 * this reference.
+				 */
+				if (folio != fault_folio)
+					folio_get(folio);
 				lazy_mmu_mode_disable();
 				pte_unmap_unlock(ptep, ptl);
 				ret = migrate_vma_split_folio(folio,

LGTM. The code duplication in this function is concerning.

Signature · 3 lines
Cheers,

David
reviewer Reviewed-by on v1 1/1
#2 lore raw
In reply to Usama Arif
Quoted 19 lines · Usama Arif

migrate_vma_collect_pmd() can detect a large folio while holding the PTE lock, then drop the PTE lock before calling migrate_vma_split_folio(). The split helper took its own reference, but only after the lock had already been dropped.

One way to hit this is device migration over a range that contains a large folio. The walker reads the PTE while holding the PTE lock and derives the folio either from a present PTE via vm_normal_page(), or from a non-present PTE that encodes a device-private softleaf entry. It then has to drop the PTE lock because split_folio() can block. Before migrate_vma_split_folio() gets a folio reference, concurrent reclaim, migration, or truncation can replace or clear the entry and drop the last reference to the folio. The split helper would then take a reference and lock on a stale folio pointer.

Take a temporary reference before dropping the PTE lock and pass that reference into migrate_vma_split_folio(). The helper consumes the reference, so split_folio() still sees only the expected caller pin instead of an extra pin that could make the split fail.

Quoted 8 lines
Fixes 022a12deda53 ("mm/migrate_device: handle partially mapped folios during collection")
---
 mm/migrate_device.c | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

LGTM. Like David said, the comments might not be needed. Thanks.

Best Regards,
Yan, Zi

maintainer
#3 lore raw
Quoted 1 line · On Wed, 01 Jul 2026 13:02:10 -0400 Zi Yan <[email protected]> wrote:

LGTM. Like David said, the comments might not be needed. Thanks.

I like the comments! They may be uninteresting to those who are already familiar with these things, but they aren't the target audience.

How are others to become familiar, if not by this?

#4 lore raw
Quoted 8 lines · Andrew Morton
Quoted 1 line · On Wed, 01 Jul 2026 13:02:10 -0400 Zi Yan <[email protected]> wrote:

LGTM. Like David said, the comments might not be needed. Thanks.

I like the comments! They may be uninteresting to those who are already familiar with these things, but they aren't the target audience.

How are others to become familiar, if not by this?

I mean, it's one of the basic rules: if you lookup a page in the page table, the moment you drop the lock that might be invalid.

If we were to document that everywhere... this is not really the secret sauce we want to document everywhere.

Signature · 3 lines
Cheers,

David
reviewer
#5 lore raw
Quoted 8 lines · David Hildenbrand (Arm)
Quoted 7 lines · Andrew Morton
Quoted 1 line · On Wed, 01 Jul 2026 13:02:10 -0400 Zi Yan <[email protected]> wrote:

LGTM. Like David said, the comments might not be needed. Thanks.

I like the comments! They may be uninteresting to those who are already familiar with these things, but they aren't the target audience.

Quoted 7 lines
Quoted 1 line

How are others to become familiar, if not by this?

I mean, it's one of the basic rules: if you lookup a page in the page table, the moment you drop the lock that might be invalid.

If we were to document that everywhere... this is not really the secret sauce we want to document everywhere.

In this particular case, split_folio() is used in migrate_vma_split_folio() and split_folio() wraps __split_huge_page_to_list_to_order(), which documents the requirement of elevated folio reference. One who wants to get familiar with kernel code can be expected to chase down to __split_huge_page_to_list_to_order() and find the requirement.

With LLMs, it is probably as easy as asking “why is folio_get() needed here?”.

Best Regards,
Yan, Zi

#6 lore raw

On 2026-07-02 at 06:16 +1000, Zi Yan <[email protected]> wrote...

Quoted 18 lines · David Hildenbrand (Arm)
Quoted 9 lines · Andrew Morton
Quoted 7 lines · On Wed, 01 Jul 2026 13:02:10 -0400 Zi Yan <[email protected]> wrote:
Quoted 2 lines

LGTM. Like David said, the comments might not be needed. Thanks.

I like the comments! They may be uninteresting to those who are already familiar with these things, but they aren't the target audience.

Quoted 7 lines
Quoted 1 line

How are others to become familiar, if not by this?

I mean, it's one of the basic rules: if you lookup a page in the page table, the moment you drop the lock that might be invalid.

If we were to document that everywhere... this is not really the secret sauce we want to document everywhere.

Quoted 7 lines

In this particular case, split_folio() is used in migrate_vma_split_folio() and split_folio() wraps __split_huge_page_to_list_to_order(), which documents the requirement of elevated folio reference. One who wants to get familiar with kernel code can be expected to chase down to __split_huge_page_to_list_to_order() and find the requirement.

With LLMs, it is probably as easy as asking “why is folio_get() needed here?”.

The interesting part of the comment isn't why the folio_get() is needed, it's where the corresponding reference is dropped/returned. I've spent far too many hours in this code trying to figure out why a page didn't migrate because of a spurious refcount and it's not easy figuring out where the matching get/puts occur.

So the comment could probably be condensed but I think it's valuable.

- Alistair

Quoted 2 lines

Best Regards,
Yan, Zi

#7 lore raw
Quoted 18 lines · Alistair Popple

On 2026-07-02 at 06:16 +1000, Zi Yan <[email protected]> wrote...

Quoted 9 lines · David Hildenbrand (Arm)
Quoted 7 lines

I mean, it's one of the basic rules: if you lookup a page in the page table, the moment you drop the lock that might be invalid.

If we were to document that everywhere... this is not really the secret sauce we want to document everywhere.

Quoted 7 lines

In this particular case, split_folio() is used in migrate_vma_split_folio() and split_folio() wraps __split_huge_page_to_list_to_order(), which documents the requirement of elevated folio reference. One who wants to get familiar with kernel code can be expected to chase down to __split_huge_page_to_list_to_order() and find the requirement.

With LLMs, it is probably as easy as asking “why is folio_get() needed here?”.

Quoted 7 lines

The interesting part of the comment isn't why the folio_get() is needed, it's where the corresponding reference is dropped/returned. I've spent far too many hours in this code trying to figure out why a page didn't migrate because of a spurious refcount and it's not easy figuring out where the matching get/puts occur.

So the comment could probably be condensed but I think it's valuable.

"migrate_vma_split_folio() consumes this reference" would be better indeed.

Signature · 3 lines
Cheers,

David
Reviewed-by on v1 1/1
#8 lore raw
In reply to Usama Arif
Quoted 14 lines · On Wed, 1 Jul 2026 07:06:38 -0700 Usama Arif <[email protected]> wrote:

migrate_vma_collect_pmd() can detect a large folio while holding the PTE lock, then drop the PTE lock before calling migrate_vma_split_folio(). The split helper took its own reference, but only after the lock had already been dropped.

One way to hit this is device migration over a range that contains a large folio. The walker reads the PTE while holding the PTE lock and derives the folio either from a present PTE via vm_normal_page(), or from a non-present PTE that encodes a device-private softleaf entry. It then has to drop the PTE lock because split_folio() can block. Before migrate_vma_split_folio() gets a folio reference, concurrent reclaim, migration, or truncation can replace or clear the entry and drop the last reference to the folio. The split helper would then take a reference and lock on a stale folio pointer.

Quoted 6 lines

Take a temporary reference before dropping the PTE lock and pass that reference into migrate_vma_split_folio(). The helper consumes the reference, so split_folio() still sees only the expected caller pin instead of an extra pin that could make the split fail.

Just curious. Has the bot sent the review directly to you? Or, you read it from sashiko.dev web site but kindly giving the credit to the bot?

Quoted 1 line

The link shows the comments for the entire series, so I was little bit confused where the real finding is. Seems like that is on the reply to the patch 5? And today I learned Sashiko.dev provides a way to point a reply to a specific patch, like this:

https://sashiko.dev/#/patchset/20260630164143.1595669-1-usama.arif%40linux.dev?part=5

Quoted 1 line
Fixes 022a12deda53 ("mm/migrate_device: handle partially mapped folios during collection")

Seems merged in 6.19. Should we Cc stable@ ?

Quoted 1 line
Quoted 45 lines
---
 mm/migrate_device.c | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)
mm/migrate_device.c +11 -3
index 2f8b646302c2..f5a5f699e98e 100644
@@ -77,6 +77,9 @@ static int migrate_vma_collect_hole(unsigned long start,
  * @folio: the folio to split
  * @fault_page: struct page associated with the fault if any
  *
+ * If @folio is not the folio containing @fault_page, the caller must hold a
+ * reference on @folio. The helper consumes that reference.
+ *
  * Returns 0 on success
  */
 static int migrate_vma_split_folio(struct folio *folio,
@@ -86,10 +89,8 @@ static int migrate_vma_split_folio(struct folio *folio,
 	struct folio *fault_folio = fault_page ? page_folio(fault_page) : NULL;
 	struct folio *new_fault_folio = NULL;
 
-	if (folio != fault_folio) {
-		folio_get(folio);
+	if (folio != fault_folio)
 		folio_lock(folio);
-	}
 
 	ret = split_folio(folio);
 	if (ret) {
@@ -310,6 +311,13 @@ static int migrate_vma_collect_pmd(pmd_t *pmdp,
 			if (folio_test_large(folio)) {
 				int ret;
 
+				/*
+				 * Keep the folio stable after dropping the PTE
+				 * lock. migrate_vma_split_folio() consumes this
+				 * reference.
+				 */
+				if (folio != fault_folio)
+					folio_get(folio);
 				lazy_mmu_mode_disable();
 				pte_unmap_unlock(ptep, ptl);
 				ret = migrate_vma_split_folio(folio,

mm/migrate_device.c static int migrate_vma_collect_pmd(pmd_t *pmdp, · line 368

Quoted 8 lines
mm/migrate_device.c +5 -0
@@ -353,6 +361,13 @@ static int migrate_vma_collect_pmd(pmd_t *pmdp,
 			if (folio && folio_test_large(folio)) {
 				int ret;
 
+				/*
+				 * Keep the folio stable after dropping the
+				 * PTE lock. migrate_vma_split_folio() consumes
+				 * this reference.
+				 */

I don't mind having the above comments. Nonetheless, having same content but different wrapping look special to me.

If people really hate having two (incompletely) duplicated comments, what about separating the recurring code out and adding the coment once on the function? Maybe having a hotfix version without the comment and later refactoring with the function can also be an option? Just a pure loud thinking.

Anyway, thank you for making Linux safer! :)

Quoted 7 lines
mm/migrate_device.c +2 -0
+				if (folio != fault_folio)
+					folio_get(folio);
 				lazy_mmu_mode_disable();
 				pte_unmap_unlock(ptep, ptl);
 				ret = migrate_vma_split_folio(folio,
Signature · 1 line
2.53.0-Meta

Thanks,
SJ

author
#9 lore raw
Quoted 21 lines · SJ Park
Quoted 19 lines · On Wed, 1 Jul 2026 07:06:38 -0700 Usama Arif <[email protected]> wrote:

migrate_vma_collect_pmd() can detect a large folio while holding the PTE lock, then drop the PTE lock before calling migrate_vma_split_folio(). The split helper took its own reference, but only after the lock had already been dropped.

One way to hit this is device migration over a range that contains a large folio. The walker reads the PTE while holding the PTE lock and derives the folio either from a present PTE via vm_normal_page(), or from a non-present PTE that encodes a device-private softleaf entry. It then has to drop the PTE lock because split_folio() can block. Before migrate_vma_split_folio() gets a folio reference, concurrent reclaim, migration, or truncation can replace or clear the entry and drop the last reference to the folio. The split helper would then take a reference and lock on a stale folio pointer.

Take a temporary reference before dropping the PTE lock and pass that reference into migrate_vma_split_folio(). The helper consumes the reference, so split_folio() still sees only the expected caller pin instead of an extra pin that could make the split fail.

Quoted 4 lines
Quoted 1 line

Just curious. Has the bot sent the review directly to you? Or, you read it from sashiko.dev web site but kindly giving the credit to the bot?

I read it from sashiko.dev!

Quoted 10 lines
Quoted 2 lines

The link shows the comments for the entire series, so I was little bit confused where the real finding is. Seems like that is on the reply to the patch 5? And today I learned Sashiko.dev provides a way to point a reply to a specific patch, like this:

https://sashiko.dev/#/patchset/20260630164143.1595669-1-usama.arif%40linux.dev?part=5

Thanks for this!

Quoted 7 lines
Quoted 1 line
Fixes 022a12deda53 ("mm/migrate_device: handle partially mapped folios during collection")

Seems merged in 6.19. Should we Cc stable@ ?

Quoted 1 line

Thanks SJ!

Quoted 76 lines
Quoted 46 lines
---
 mm/migrate_device.c | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)
mm/migrate_device.c +11 -3
index 2f8b646302c2..f5a5f699e98e 100644
@@ -77,6 +77,9 @@ static int migrate_vma_collect_hole(unsigned long start,
  * @folio: the folio to split
  * @fault_page: struct page associated with the fault if any
  *
+ * If @folio is not the folio containing @fault_page, the caller must hold a
+ * reference on @folio. The helper consumes that reference.
+ *
  * Returns 0 on success
  */
 static int migrate_vma_split_folio(struct folio *folio,
@@ -86,10 +89,8 @@ static int migrate_vma_split_folio(struct folio *folio,
 	struct folio *fault_folio = fault_page ? page_folio(fault_page) : NULL;
 	struct folio *new_fault_folio = NULL;
 
-	if (folio != fault_folio) {
-		folio_get(folio);
+	if (folio != fault_folio)
 		folio_lock(folio);
-	}
 
 	ret = split_folio(folio);
 	if (ret) {
@@ -310,6 +311,13 @@ static int migrate_vma_collect_pmd(pmd_t *pmdp,
 			if (folio_test_large(folio)) {
 				int ret;
 
+				/*
+				 * Keep the folio stable after dropping the PTE
+				 * lock. migrate_vma_split_folio() consumes this
+				 * reference.
+				 */
+				if (folio != fault_folio)
+					folio_get(folio);
 				lazy_mmu_mode_disable();
 				pte_unmap_unlock(ptep, ptl);
 				ret = migrate_vma_split_folio(folio,

mm/migrate_device.c static int migrate_vma_collect_pmd(pmd_t *pmdp, · line 368

Quoted 8 lines
mm/migrate_device.c +5 -0
@@ -353,6 +361,13 @@ static int migrate_vma_collect_pmd(pmd_t *pmdp,
 			if (folio && folio_test_large(folio)) {
 				int ret;
 
+				/*
+				 * Keep the folio stable after dropping the
+				 * PTE lock. migrate_vma_split_folio() consumes
+				 * this reference.
+				 */

I don't mind having the above comments. Nonetheless, having same content but different wrapping look special to me.

If people really hate having two (incompletely) duplicated comments, what about separating the recurring code out and adding the coment once on the function? Maybe having a hotfix version without the comment and later refactoring with the function can also be an option? Just a pure loud thinking.

Anyway, thank you for making Linux safer! :)

Quoted 7 lines
mm/migrate_device.c +2 -0
+				if (folio != fault_folio)
+					folio_get(folio);
 				lazy_mmu_mode_disable();
 				pte_unmap_unlock(ptep, ptl);
 				ret = migrate_vma_split_folio(folio,
Signature · 1 line
2.53.0-Meta

Thanks,
SJ

Reviewed-by on v1 1/1
#10 lore raw
In reply to Usama Arif
Quoted 14 lines · Usama Arif

migrate_vma_collect_pmd() can detect a large folio while holding the PTE lock, then drop the PTE lock before calling migrate_vma_split_folio(). The split helper took its own reference, but only after the lock had already been dropped.

One way to hit this is device migration over a range that contains a large folio. The walker reads the PTE while holding the PTE lock and derives the folio either from a present PTE via vm_normal_page(), or from a non-present PTE that encodes a device-private softleaf entry. It then has to drop the PTE lock because split_folio() can block. Before migrate_vma_split_folio() gets a folio reference, concurrent reclaim, migration, or truncation can replace or clear the entry and drop the last reference to the folio. The split helper would then take a reference and lock on a stale folio pointer.

Quoted 4 lines

Take a temporary reference before dropping the PTE lock and pass that reference into migrate_vma_split_folio(). The helper consumes the reference, so split_folio() still sees only the expected caller pin instead of an extra pin that could make the split fail.

Yeah, that's how it should have been:

lookup under PTL -> get folio ref -> drop PTL.

Getting a ref after dropping PTL feels a bit too optimistic ...

Quoted 5 lines
Fixes 022a12deda53 ("mm/migrate_device: handle partially mapped folios during collection")

---

Thanks for fixing it! Feel free to add:

author
#11 lore raw
In reply to Usama Arif
Quoted 19 lines · Usama Arif

migrate_vma_collect_pmd() can detect a large folio while holding the PTE lock, then drop the PTE lock before calling migrate_vma_split_folio(). The split helper took its own reference, but only after the lock had already been dropped.

One way to hit this is device migration over a range that contains a large folio. The walker reads the PTE while holding the PTE lock and derives the folio either from a present PTE via vm_normal_page(), or from a non-present PTE that encodes a device-private softleaf entry. It then has to drop the PTE lock because split_folio() can block. Before migrate_vma_split_folio() gets a folio reference, concurrent reclaim, migration, or truncation can replace or clear the entry and drop the last reference to the folio. The split helper would then take a reference and lock on a stale folio pointer.

Take a temporary reference before dropping the PTE lock and pass that reference into migrate_vma_split_folio(). The helper consumes the reference, so split_folio() still sees only the expected caller pin instead of an extra pin that could make the split fail.

Quoted 8 lines
Fixes 022a12deda53 ("mm/migrate_device: handle partially mapped folios during collection")
---
 mm/migrate_device.c | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

Hi Andrew!

Could you apply the below fixlet to condense the comment as per Davids', Alistairs' and Zis' suggestion? I can send a v2 if its easier as well. Thanks!

From 022bfeb9573f745cc1d93468d1cc123cf6507581 Mon Sep 17 00:00:00 2001
From: Usama Arif <[email protected]>
Date: Wed, 1 Jul 2026 11:12:54 -0700
Subject: [fixup] condense comment about folio reference

---
 mm/migrate_device.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)
mm/migrate_device.c +2 -10
index f5a5f699e98e..052167f9ad54 100644
@@ -311,11 +311,7 @@ static int migrate_vma_collect_pmd(pmd_t *pmdp,
 			if (folio_test_large(folio)) {
 				int ret;
 
-				/*
-				 * Keep the folio stable after dropping the PTE
-				 * lock. migrate_vma_split_folio() consumes this
-				 * reference.
-				 */
+				/* migrate_vma_split_folio() consumes this reference */
 				if (folio != fault_folio)
 					folio_get(folio);
 				lazy_mmu_mode_disable();
@@ -361,11 +357,7 @@ static int migrate_vma_collect_pmd(pmd_t *pmdp,
 			if (folio && folio_test_large(folio)) {
 				int ret;
 
-				/*
-				 * Keep the folio stable after dropping the
-				 * PTE lock. migrate_vma_split_folio() consumes
-				 * this reference.
-				 */
+				/* migrate_vma_split_folio() consumes this reference */
 				if (folio != fault_folio)
 					folio_get(folio);
 				lazy_mmu_mode_disable();
Signature · 1 line
2.53.0-Meta