linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/migrate_device: fix double unlock
@ 2026-04-13 21:15 Sunny Patel
  2026-04-14 10:03 ` David Hildenbrand (Arm)
  0 siblings, 1 reply; 4+ messages in thread
From: Sunny Patel @ 2026-04-13 21:15 UTC (permalink / raw)
  To: Andrew Morton
  Cc: David Hildenbrand, Zi Yan, Matthew Brost, Joshua Hahn, Rakie Kim,
	Byungchul Park, Gregory Price, Ying Huang, Alistair Popple,
	Balbir Singh, linux-mm, linux-kernel, Sunny Patel, stable

migrate_vma_collect_huge_pmd() calls spin_unlock(ptl) after
softleaf_entry_wait_on_locked(), which already releases the ptl.

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

Cc: stable@vger.kernel.org

Signed-off-by: Sunny Patel <nueralspacetech@gmail.com>
---
 mm/migrate_device.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/mm/migrate_device.c b/mm/migrate_device.c
index 8079676c8f1f..7eb2f87ea39d 100644
--- a/mm/migrate_device.c
+++ b/mm/migrate_device.c
@@ -177,7 +177,6 @@ static int migrate_vma_collect_huge_pmd(pmd_t *pmdp, unsigned long start,
 
 		if (softleaf_is_migration(entry)) {
 			softleaf_entry_wait_on_locked(entry, ptl);
-			spin_unlock(ptl);
 			return -EAGAIN;
 		}
 
-- 
2.43.0



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

* Re: [PATCH] mm/migrate_device: fix double unlock
  2026-04-13 21:15 [PATCH] mm/migrate_device: fix double unlock Sunny Patel
@ 2026-04-14 10:03 ` David Hildenbrand (Arm)
  2026-04-14 11:53   ` Balbir Singh
  2026-04-14 13:13   ` Sunny Patel
  0 siblings, 2 replies; 4+ messages in thread
From: David Hildenbrand (Arm) @ 2026-04-14 10:03 UTC (permalink / raw)
  To: Sunny Patel, Andrew Morton
  Cc: Zi Yan, Matthew Brost, Joshua Hahn, Rakie Kim, Byungchul Park,
	Gregory Price, Ying Huang, Alistair Popple, Balbir Singh,
	linux-mm, linux-kernel, stable

On 4/13/26 23:15, Sunny Patel wrote:
> migrate_vma_collect_huge_pmd() calls spin_unlock(ptl) after
> softleaf_entry_wait_on_locked(), which already releases the ptl.
> 
> Fixes: a30b48bf1b24 ("mm/migrate_device: implement THP migration of zone device pages")
> 
> Cc: stable@vger.kernel.org
> 
> Signed-off-by: Sunny Patel <nueralspacetech@gmail.com>
> ---
>  mm/migrate_device.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/mm/migrate_device.c b/mm/migrate_device.c
> index 8079676c8f1f..7eb2f87ea39d 100644
> --- a/mm/migrate_device.c
> +++ b/mm/migrate_device.c
> @@ -177,7 +177,6 @@ static int migrate_vma_collect_huge_pmd(pmd_t *pmdp, unsigned long start,
>  
>  		if (softleaf_is_migration(entry)) {
>  			softleaf_entry_wait_on_locked(entry, ptl);
> -			spin_unlock(ptl);
>  			return -EAGAIN;
>  		}
>  

As raised by Matthew, the entire code block is dead code:

https://lore.kernel.org/linux-mm/20260212014611.416695-1-dave@stgolabs.net/

And I even Ack'ed it /facepalm

So we should take that (cleanup) patch instead. Thanks!

-- 
Cheers,

David


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

* Re: [PATCH] mm/migrate_device: fix double unlock
  2026-04-14 10:03 ` David Hildenbrand (Arm)
@ 2026-04-14 11:53   ` Balbir Singh
  2026-04-14 13:13   ` Sunny Patel
  1 sibling, 0 replies; 4+ messages in thread
From: Balbir Singh @ 2026-04-14 11:53 UTC (permalink / raw)
  To: David Hildenbrand (Arm), Sunny Patel, Andrew Morton
  Cc: Zi Yan, Matthew Brost, Joshua Hahn, Rakie Kim, Byungchul Park,
	Gregory Price, Ying Huang, Alistair Popple, linux-mm,
	linux-kernel, stable

On 4/14/26 20:03, David Hildenbrand (Arm) wrote:
> On 4/13/26 23:15, Sunny Patel wrote:
>> migrate_vma_collect_huge_pmd() calls spin_unlock(ptl) after
>> softleaf_entry_wait_on_locked(), which already releases the ptl.
>>
>> Fixes: a30b48bf1b24 ("mm/migrate_device: implement THP migration of zone device pages")
>>
>> Cc: stable@vger.kernel.org
>>
>> Signed-off-by: Sunny Patel <nueralspacetech@gmail.com>
>> ---
>>  mm/migrate_device.c | 1 -
>>  1 file changed, 1 deletion(-)
>>
>> diff --git a/mm/migrate_device.c b/mm/migrate_device.c
>> index 8079676c8f1f..7eb2f87ea39d 100644
>> --- a/mm/migrate_device.c
>> +++ b/mm/migrate_device.c
>> @@ -177,7 +177,6 @@ static int migrate_vma_collect_huge_pmd(pmd_t *pmdp, unsigned long start,
>>  
>>  		if (softleaf_is_migration(entry)) {
>>  			softleaf_entry_wait_on_locked(entry, ptl);
>> -			spin_unlock(ptl);
>>  			return -EAGAIN;
>>  		}
>>  
> 
> As raised by Matthew, the entire code block is dead code:
> 
> https://lore.kernel.org/linux-mm/20260212014611.416695-1-dave@stgolabs.net/
> 
> And I even Ack'ed it /facepalm
> 
> So we should take that (cleanup) patch instead. Thanks!
> 

+1

Balbir


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

* Re: [PATCH] mm/migrate_device: fix double unlock
  2026-04-14 10:03 ` David Hildenbrand (Arm)
  2026-04-14 11:53   ` Balbir Singh
@ 2026-04-14 13:13   ` Sunny Patel
  1 sibling, 0 replies; 4+ messages in thread
From: Sunny Patel @ 2026-04-14 13:13 UTC (permalink / raw)
  To: david
  Cc: akpm, apopple, balbirs, byungchul, gourry, joshua.hahnjy,
	linux-kernel, linux-mm, matthew.brost, nueralspacetech,
	rakie.kim, stable, ying.huang, ziy

On 4/14/26 20:03, David Hildenbrand (Arm) wrote:
> As raised by Matthew, the entire code block is dead code:
> https://lore.kernel.org/linux-mm/20260212014611.416695-1-dave@stgolabs.net/
> And I even Ack'ed it /facepalm
> So we should take that (cleanup) patch instead. Thanks!

+1 

Thanks for the pointer. I will drop my cleanup patch and defer
to above patch at the above link instead since it already
addresses the same dead code block and has your Ack.

Thanks,
Sunny Patel


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

end of thread, other threads:[~2026-04-14 13:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-04-13 21:15 [PATCH] mm/migrate_device: fix double unlock Sunny Patel
2026-04-14 10:03 ` David Hildenbrand (Arm)
2026-04-14 11:53   ` Balbir Singh
2026-04-14 13:13   ` Sunny Patel

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