linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/migrate_device: remove dead migration entry check in migrate_vma_collect_huge_pmd()
@ 2026-02-12  1:46 Davidlohr Bueso
  2026-02-12  2:00 ` Alistair Popple
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Davidlohr Bueso @ 2026-02-12  1:46 UTC (permalink / raw)
  To: akpm
  Cc: balbirs, matthew.brost, apopple, thomas.hellstrom, jhubbard, jgg,
	linux-mm, Davidlohr Bueso

The softleaf_is_migration() check is unreachable as entries that are not
device_private are filtered out. Similarly, the PTE-level equivalent in
migrate_vma_collect_pmd() skips migration entries.

This dead branch also contained a double spin_unlock(ptl) bug.

Suggested-by: Matthew Brost <matthew.brost@intel.com>
Signed-off-by: Davidlohr Bueso <dave@stgolabs.net>
---
 mm/migrate_device.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/mm/migrate_device.c b/mm/migrate_device.c
index c2855235fd9a..b40c1d49677d 100644
--- a/mm/migrate_device.c
+++ b/mm/migrate_device.c
@@ -175,13 +175,6 @@ static int migrate_vma_collect_huge_pmd(pmd_t *pmdp, unsigned long start,
 			return migrate_vma_collect_skip(start, end, walk);
 		}
 
-		if (softleaf_is_migration(entry)) {
-			migration_entry_wait_on_locked(entry, ptl);
-			spin_unlock(ptl);
-			return -EAGAIN;
-		}
-
 		if (softleaf_is_device_private_write(entry))
 			write = MIGRATE_PFN_WRITE;
 	} else {
--
2.39.5



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mm/migrate_device: remove dead migration entry check in migrate_vma_collect_huge_pmd()
  2026-02-12  1:46 [PATCH] mm/migrate_device: remove dead migration entry check in migrate_vma_collect_huge_pmd() Davidlohr Bueso
@ 2026-02-12  2:00 ` Alistair Popple
  2026-02-12 12:37 ` David Hildenbrand (Arm)
  2026-02-12 21:16 ` Balbir Singh
  2 siblings, 0 replies; 4+ messages in thread
From: Alistair Popple @ 2026-02-12  2:00 UTC (permalink / raw)
  To: Davidlohr Bueso
  Cc: akpm, balbirs, matthew.brost, thomas.hellstrom, jhubbard, jgg, linux-mm

On 2026-02-12 at 12:46 +1100, Davidlohr Bueso <dave@stgolabs.net> wrote...
> The softleaf_is_migration() check is unreachable as entries that are not
> device_private are filtered out. Similarly, the PTE-level equivalent in
> migrate_vma_collect_pmd() skips migration entries.
> 
> This dead branch also contained a double spin_unlock(ptl) bug.

Heh. You beat me by 10 minutes :-) I was just checking to see if the fix had
already been sent before pressing send on mine.

You probably want to add:

Fixes: a30b48bf1b244 ("mm/migrate_device: implement THP migration of zone device pages")

But other than that this looks good so:

Reviewed-by: Alistair Popple <apopple@nvidia.com>

> Suggested-by: Matthew Brost <matthew.brost@intel.com>
> Signed-off-by: Davidlohr Bueso <dave@stgolabs.net>
> ---
>  mm/migrate_device.c | 6 ------
>  1 file changed, 6 deletions(-)
> 
> diff --git a/mm/migrate_device.c b/mm/migrate_device.c
> index c2855235fd9a..b40c1d49677d 100644
> --- a/mm/migrate_device.c
> +++ b/mm/migrate_device.c
> @@ -175,13 +175,6 @@ static int migrate_vma_collect_huge_pmd(pmd_t *pmdp, unsigned long start,
>  			return migrate_vma_collect_skip(start, end, walk);
>  		}
>  
> -		if (softleaf_is_migration(entry)) {
> -			migration_entry_wait_on_locked(entry, ptl);
> -			spin_unlock(ptl);
> -			return -EAGAIN;
> -		}
> -
>  		if (softleaf_is_device_private_write(entry))
>  			write = MIGRATE_PFN_WRITE;
>  	} else {
> --
> 2.39.5
> 
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mm/migrate_device: remove dead migration entry check in migrate_vma_collect_huge_pmd()
  2026-02-12  1:46 [PATCH] mm/migrate_device: remove dead migration entry check in migrate_vma_collect_huge_pmd() Davidlohr Bueso
  2026-02-12  2:00 ` Alistair Popple
@ 2026-02-12 12:37 ` David Hildenbrand (Arm)
  2026-02-12 21:16 ` Balbir Singh
  2 siblings, 0 replies; 4+ messages in thread
From: David Hildenbrand (Arm) @ 2026-02-12 12:37 UTC (permalink / raw)
  To: Davidlohr Bueso, akpm
  Cc: balbirs, matthew.brost, apopple, thomas.hellstrom, jhubbard, jgg,
	linux-mm

On 2/12/26 02:46, Davidlohr Bueso wrote:
> The softleaf_is_migration() check is unreachable as entries that are not
> device_private are filtered out. Similarly, the PTE-level equivalent in
> migrate_vma_collect_pmd() skips migration entries.
> 
> This dead branch also contained a double spin_unlock(ptl) bug.
> 
> Suggested-by: Matthew Brost <matthew.brost@intel.com>
> Signed-off-by: Davidlohr Bueso <dave@stgolabs.net>
> ---

Acked-by: David Hildenbrand (Arm) <david@kernel.org>

-- 
Cheers,

David


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mm/migrate_device: remove dead migration entry check in migrate_vma_collect_huge_pmd()
  2026-02-12  1:46 [PATCH] mm/migrate_device: remove dead migration entry check in migrate_vma_collect_huge_pmd() Davidlohr Bueso
  2026-02-12  2:00 ` Alistair Popple
  2026-02-12 12:37 ` David Hildenbrand (Arm)
@ 2026-02-12 21:16 ` Balbir Singh
  2 siblings, 0 replies; 4+ messages in thread
From: Balbir Singh @ 2026-02-12 21:16 UTC (permalink / raw)
  To: Davidlohr Bueso, akpm
  Cc: matthew.brost, apopple, thomas.hellstrom, jhubbard, jgg, linux-mm

On 2/12/26 12:46, Davidlohr Bueso wrote:
> The softleaf_is_migration() check is unreachable as entries that are not
> device_private are filtered out. Similarly, the PTE-level equivalent in
> migrate_vma_collect_pmd() skips migration entries.
> 
> This dead branch also contained a double spin_unlock(ptl) bug.
> 
> Suggested-by: Matthew Brost <matthew.brost@intel.com>
> Signed-off-by: Davidlohr Bueso <dave@stgolabs.net>
> ---
>  mm/migrate_device.c | 6 ------
>  1 file changed, 6 deletions(-)
> 
> diff --git a/mm/migrate_device.c b/mm/migrate_device.c
> index c2855235fd9a..b40c1d49677d 100644
> --- a/mm/migrate_device.c
> +++ b/mm/migrate_device.c
> @@ -175,13 +175,6 @@ static int migrate_vma_collect_huge_pmd(pmd_t *pmdp, unsigned long start,
>  			return migrate_vma_collect_skip(start, end, walk);
>  		}
>  
> -		if (softleaf_is_migration(entry)) {
> -			migration_entry_wait_on_locked(entry, ptl);
> -			spin_unlock(ptl);
> -			return -EAGAIN;
> -		}
> -
>  		if (softleaf_is_device_private_write(entry))
>  			write = MIGRATE_PFN_WRITE;
>  	} else {

Acked-by: Balbir Singh <balbirs@nvidia.com>


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-02-12 21:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-02-12  1:46 [PATCH] mm/migrate_device: remove dead migration entry check in migrate_vma_collect_huge_pmd() Davidlohr Bueso
2026-02-12  2:00 ` Alistair Popple
2026-02-12 12:37 ` David Hildenbrand (Arm)
2026-02-12 21:16 ` Balbir Singh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox