Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mm/rmap: remove stale hugetlb check in try_to_unmap_one
@ 2026-08-31  8:28 Dev Jain
  2026-08-31  8:47 ` Lorenzo Stoakes (ARM)
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Dev Jain @ 2026-08-31  8:28 UTC (permalink / raw)
  To: akpm, david, ljs
  Cc: Dev Jain, riel, liam, vbabka, harry, jannh, lance.yang, linux-mm,
	linux-kernel

Post commit d4ec5572825a ("mm/rmap: add try_to_unmap_poisoned_hugetlb_one")
try_to_unmap_one() cannot be called with a hugetlb folio. Therefore remove
the folio_test_hugetlb() check.

Signed-off-by: Dev Jain <dev.jain@arm.com>
---
Rebase soup - my huge_ptep_get() fixes landed after the refactoring.

This patch applies on Linux 7.3-rc1.

 mm/rmap.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/mm/rmap.c b/mm/rmap.c
index d1819fd699380..606c8ecf31302 100644
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -2299,11 +2299,8 @@ static bool try_to_unmap_one(struct folio *folio, struct vm_area_struct *vma,
 		VM_BUG_ON_FOLIO(!pvmw.pte, folio);
 
 		address = pvmw.address;
-		if (folio_test_hugetlb(folio)) {
-			pteval = huge_ptep_get(mm, address, pvmw.pte);
-		} else {
-			pteval = ptep_get(pvmw.pte);
-		}
+		pteval = ptep_get(pvmw.pte);
+
 		if (likely(pte_present(pteval))) {
 			pfn = pte_pfn(pteval);
 		} else {
-- 
2.43.0



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

* Re: [PATCH] mm/rmap: remove stale hugetlb check in try_to_unmap_one
  2026-08-31  8:28 [PATCH] mm/rmap: remove stale hugetlb check in try_to_unmap_one Dev Jain
@ 2026-08-31  8:47 ` Lorenzo Stoakes (ARM)
  2026-08-31  9:13 ` Lance Yang
  2026-08-31 15:59 ` Kunwu Chan
  2 siblings, 0 replies; 6+ messages in thread
From: Lorenzo Stoakes (ARM) @ 2026-08-31  8:47 UTC (permalink / raw)
  To: Dev Jain
  Cc: akpm, david, riel, liam, vbabka, harry, jannh, lance.yang,
	linux-mm, linux-kernel

On Mon, Aug 31, 2026 at 08:28:47AM +0000, Dev Jain wrote:
> Post commit d4ec5572825a ("mm/rmap: add try_to_unmap_poisoned_hugetlb_one")
> try_to_unmap_one() cannot be called with a hugetlb folio. Therefore remove
> the folio_test_hugetlb() check.
>
> Signed-off-by: Dev Jain <dev.jain@arm.com>

LGTM so:

Reviewed-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>

> ---
> Rebase soup - my huge_ptep_get() fixes landed after the refactoring.
>
> This patch applies on Linux 7.3-rc1.
>
>  mm/rmap.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/mm/rmap.c b/mm/rmap.c
> index d1819fd699380..606c8ecf31302 100644
> --- a/mm/rmap.c
> +++ b/mm/rmap.c
> @@ -2299,11 +2299,8 @@ static bool try_to_unmap_one(struct folio *folio, struct vm_area_struct *vma,
>  		VM_BUG_ON_FOLIO(!pvmw.pte, folio);
>
>  		address = pvmw.address;
> -		if (folio_test_hugetlb(folio)) {
> -			pteval = huge_ptep_get(mm, address, pvmw.pte);
> -		} else {
> -			pteval = ptep_get(pvmw.pte);
> -		}
> +		pteval = ptep_get(pvmw.pte);
> +
>  		if (likely(pte_present(pteval))) {
>  			pfn = pte_pfn(pteval);
>  		} else {
> --
> 2.43.0
>

--
Cheers, Lorenzo


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

* Re: [PATCH] mm/rmap: remove stale hugetlb check in try_to_unmap_one
  2026-08-31  8:28 [PATCH] mm/rmap: remove stale hugetlb check in try_to_unmap_one Dev Jain
  2026-08-31  8:47 ` Lorenzo Stoakes (ARM)
@ 2026-08-31  9:13 ` Lance Yang
  2026-08-31 15:59 ` Kunwu Chan
  2 siblings, 0 replies; 6+ messages in thread
From: Lance Yang @ 2026-08-31  9:13 UTC (permalink / raw)
  To: Dev Jain
  Cc: riel, liam, ljs, david, vbabka, harry, jannh, linux-mm,
	linux-kernel, akpm



On 2026/8/31 16:28, Dev Jain wrote:
> Post commit d4ec5572825a ("mm/rmap: add try_to_unmap_poisoned_hugetlb_one")
> try_to_unmap_one() cannot be called with a hugetlb folio. Therefore remove
> the folio_test_hugetlb() check.
> 
> Signed-off-by: Dev Jain <dev.jain@arm.com>
> ---

Reviewed-by: Lance Yang <lance.yang@linux.dev>


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

* Re: [PATCH] mm/rmap: remove stale hugetlb check in try_to_unmap_one
  2026-08-31  8:28 [PATCH] mm/rmap: remove stale hugetlb check in try_to_unmap_one Dev Jain
  2026-08-31  8:47 ` Lorenzo Stoakes (ARM)
  2026-08-31  9:13 ` Lance Yang
@ 2026-08-31 15:59 ` Kunwu Chan
  2026-08-31 16:00   ` Lorenzo Stoakes (ARM)
  2 siblings, 1 reply; 6+ messages in thread
From: Kunwu Chan @ 2026-08-31 15:59 UTC (permalink / raw)
  To: Dev Jain
  Cc: Kunwu Chan, akpm, david, ljs, riel, liam, vbabka, harry, jannh,
	lance.yang, linux-mm, linux-kernel, Kunwu Chan

On Mon, 31 Aug 2026 08:28:47 +0000 Dev Jain <dev.jain@arm.com> wrote:

> Post commit d4ec5572825a ("mm/rmap: add try_to_unmap_poisoned_hugetlb_one")
> try_to_unmap_one() cannot be called with a hugetlb folio. Therefore remove
> the folio_test_hugetlb() check.

Yes, the d4ec5572825 change shows that try_to_unmap() dispatches 
hugetlb folios to try_to_unmap_poisoned_hugetlb_one(), 
so try_to_unmap_one() cannot be called with a hugetlb folio.


It would be better to add:
Fixes: d4ec5572825 ("mm/rmap: add try_to_unmap_poisoned_hugetlb_one")

Reviewed-by: Kunwu Chan <kunwu.chan@gmail.com>

Thanks,
KunWu

> 
> Signed-off-by: Dev Jain <dev.jain@arm.com>
> ---
> Rebase soup - my huge_ptep_get() fixes landed after the refactoring.
> 
> This patch applies on Linux 7.3-rc1.
> 
>  mm/rmap.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/mm/rmap.c b/mm/rmap.c
> index d1819fd699380..606c8ecf31302 100644
> --- a/mm/rmap.c
> +++ b/mm/rmap.c
> @@ -2299,11 +2299,8 @@ static bool try_to_unmap_one(struct folio *folio, struct vm_area_struct *vma,
>  		VM_BUG_ON_FOLIO(!pvmw.pte, folio);
>  
>  		address = pvmw.address;
> -		if (folio_test_hugetlb(folio)) {
> -			pteval = huge_ptep_get(mm, address, pvmw.pte);
> -		} else {
> -			pteval = ptep_get(pvmw.pte);
> -		}
> +		pteval = ptep_get(pvmw.pte);
> +
>  		if (likely(pte_present(pteval))) {
>  			pfn = pte_pfn(pteval);
>  		} else {
> -- 
> 2.43.0
> 
> 



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

* Re: [PATCH] mm/rmap: remove stale hugetlb check in try_to_unmap_one
  2026-08-31 15:59 ` Kunwu Chan
@ 2026-08-31 16:00   ` Lorenzo Stoakes (ARM)
  2026-08-31 16:41     ` Kunwu Chan
  0 siblings, 1 reply; 6+ messages in thread
From: Lorenzo Stoakes (ARM) @ 2026-08-31 16:00 UTC (permalink / raw)
  To: Kunwu Chan
  Cc: Dev Jain, Kunwu Chan, akpm, david, riel, liam, vbabka, harry,
	jannh, lance.yang, linux-mm, linux-kernel

On Mon, Aug 31, 2026 at 11:59:12PM +0800, Kunwu Chan wrote:
> On Mon, 31 Aug 2026 08:28:47 +0000 Dev Jain <dev.jain@arm.com> wrote:
>
> > Post commit d4ec5572825a ("mm/rmap: add try_to_unmap_poisoned_hugetlb_one")
> > try_to_unmap_one() cannot be called with a hugetlb folio. Therefore remove
> > the folio_test_hugetlb() check.
>
> Yes, the d4ec5572825 change shows that try_to_unmap() dispatches
> hugetlb folios to try_to_unmap_poisoned_hugetlb_one(),
> so try_to_unmap_one() cannot be called with a hugetlb folio.
>
>
> It would be better to add:
> Fixes: d4ec5572825 ("mm/rmap: add try_to_unmap_poisoned_hugetlb_one")

Nope, let's not thanks.

This isn't a bug.

>
> Reviewed-by: Kunwu Chan <kunwu.chan@gmail.com>
>
> Thanks,
> KunWu
>
> >
> > Signed-off-by: Dev Jain <dev.jain@arm.com>
> > ---
> > Rebase soup - my huge_ptep_get() fixes landed after the refactoring.
> >
> > This patch applies on Linux 7.3-rc1.
> >
> >  mm/rmap.c | 7 ++-----
> >  1 file changed, 2 insertions(+), 5 deletions(-)
> >
> > diff --git a/mm/rmap.c b/mm/rmap.c
> > index d1819fd699380..606c8ecf31302 100644
> > --- a/mm/rmap.c
> > +++ b/mm/rmap.c
> > @@ -2299,11 +2299,8 @@ static bool try_to_unmap_one(struct folio *folio, struct vm_area_struct *vma,
> >  		VM_BUG_ON_FOLIO(!pvmw.pte, folio);
> >
> >  		address = pvmw.address;
> > -		if (folio_test_hugetlb(folio)) {
> > -			pteval = huge_ptep_get(mm, address, pvmw.pte);
> > -		} else {
> > -			pteval = ptep_get(pvmw.pte);
> > -		}
> > +		pteval = ptep_get(pvmw.pte);
> > +
> >  		if (likely(pte_present(pteval))) {
> >  			pfn = pte_pfn(pteval);
> >  		} else {
> > --
> > 2.43.0
> >
> >
>

--
Cheers, Lorenzo


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

* Re: [PATCH] mm/rmap: remove stale hugetlb check in try_to_unmap_one
  2026-08-31 16:00   ` Lorenzo Stoakes (ARM)
@ 2026-08-31 16:41     ` Kunwu Chan
  0 siblings, 0 replies; 6+ messages in thread
From: Kunwu Chan @ 2026-08-31 16:41 UTC (permalink / raw)
  To: Lorenzo Stoakes (ARM)
  Cc: Kunwu Chan, Kunwu Chan, Dev Jain, akpm, david, riel, liam, vbabka,
	harry, jannh, lance.yang, linux-mm, linux-kernel

On Mon, 31 Aug 2026 17:00:56 +0100 "Lorenzo Stoakes (ARM)" <ljs@kernel.org> wrote:

> On Mon, Aug 31, 2026 at 11:59:12PM +0800, Kunwu Chan wrote:
> > On Mon, 31 Aug 2026 08:28:47 +0000 Dev Jain <dev.jain@arm.com> wrote:
> >
> > > Post commit d4ec5572825a ("mm/rmap: add try_to_unmap_poisoned_hugetlb_one")
> > > try_to_unmap_one() cannot be called with a hugetlb folio. Therefore remove
> > > the folio_test_hugetlb() check.
> >
> > Yes, the d4ec5572825 change shows that try_to_unmap() dispatches
> > hugetlb folios to try_to_unmap_poisoned_hugetlb_one(),
> > so try_to_unmap_one() cannot be called with a hugetlb folio.
> >
> >
> > It would be better to add:
> > Fixes: d4ec5572825 ("mm/rmap: add try_to_unmap_poisoned_hugetlb_one")
> 
> Nope, let's not thanks.
> 
> This isn't a bug.
> 

Got it, thanks for pointing that out. 
I mistakenly treated the stale code as a bug.

Thanks,
KunWu

> >
> > Reviewed-by: Kunwu Chan <kunwu.chan@gmail.com>
> >
> > Thanks,
> > KunWu
> >
> > >
> > > Signed-off-by: Dev Jain <dev.jain@arm.com>
> > > ---
> > > Rebase soup - my huge_ptep_get() fixes landed after the refactoring.
> > >
> > > This patch applies on Linux 7.3-rc1.
> > >
> > >  mm/rmap.c | 7 ++-----
> > >  1 file changed, 2 insertions(+), 5 deletions(-)
> > >
> > > diff --git a/mm/rmap.c b/mm/rmap.c
> > > index d1819fd699380..606c8ecf31302 100644
> > > --- a/mm/rmap.c
> > > +++ b/mm/rmap.c
> > > @@ -2299,11 +2299,8 @@ static bool try_to_unmap_one(struct folio *folio, struct vm_area_struct *vma,
> > >  		VM_BUG_ON_FOLIO(!pvmw.pte, folio);
> > >
> > >  		address = pvmw.address;
> > > -		if (folio_test_hugetlb(folio)) {
> > > -			pteval = huge_ptep_get(mm, address, pvmw.pte);
> > > -		} else {
> > > -			pteval = ptep_get(pvmw.pte);
> > > -		}
> > > +		pteval = ptep_get(pvmw.pte);
> > > +
> > >  		if (likely(pte_present(pteval))) {
> > >  			pfn = pte_pfn(pteval);
> > >  		} else {
> > > --
> > > 2.43.0
> > >
> > >
> >
> 
> --
> Cheers, Lorenzo
> 



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

end of thread, other threads:[~2026-08-31 16:42 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-31  8:28 [PATCH] mm/rmap: remove stale hugetlb check in try_to_unmap_one Dev Jain
2026-08-31  8:47 ` Lorenzo Stoakes (ARM)
2026-08-31  9:13 ` Lance Yang
2026-08-31 15:59 ` Kunwu Chan
2026-08-31 16:00   ` Lorenzo Stoakes (ARM)
2026-08-31 16:41     ` Kunwu Chan

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