mm/rmap: remove stale hugetlb check in try_to_unmap_one
Subsystems (2)
PATCH 1/1 mm/rmap: remove stale hugetlb check in try_to_unmap_one
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.
---
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(-)
mm/rmap.c +2 -5
@@ -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 {
Signature · 1 line
2.43.0
Quoted 5 lines · Dev Jain
Post commit
d4ec5572825a("mm/rmap: addtry_to_unmap_poisoned_hugetlb_one")try_to_unmap_one()cannot be called with a hugetlb folio. Therefore remove thefolio_test_hugetlb()check.Signed-off-by Dev Jain <[email protected]>
LGTM so:
Quoted 27 lines
---
Rebase soup - myhuge_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(-)mm/rmap.c +2
-6@@ -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 { --
Quoted 2 lines
2.43.0
--
Cheers, Lorenzo
Quoted 6 lines · Dev Jain
Post commit
d4ec5572825a("mm/rmap: addtry_to_unmap_poisoned_hugetlb_one")try_to_unmap_one()cannot be called with a hugetlb folio. Therefore remove thefolio_test_hugetlb()check.Signed-off-by Dev Jain <[email protected]>---
Quoted 3 lines · On Mon, 31 Aug 2026 08:28:47 +0000 Dev Jain <[email protected]> wrote:
Post commit
d4ec5572825a("mm/rmap: addtry_to_unmap_poisoned_hugetlb_one")try_to_unmap_one()cannot be called with a hugetlb folio. Therefore remove thefolio_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:
Thanks,
KunWu
Quoted 32 lines
Signed-off-by Dev Jain <[email protected]>---
Rebase soup - myhuge_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(-)mm/rmap.c +2
-5@@ -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 {Signature · 1 line
2.43.0
Lorenzo Stoakes (ARM)
maintainerQuoted 6 lines · Kunwu Chan
Quoted 3 lines · On Mon, 31 Aug 2026 08:28:47 +0000 Dev Jain <[email protected]> wrote:
Post commit
d4ec5572825a("mm/rmap: addtry_to_unmap_poisoned_hugetlb_one")try_to_unmap_one()cannot be called with a hugetlb folio. Therefore remove thefolio_test_hugetlb()check.
Quoted 7 lines
Yes, the
d4ec5572825change shows thattry_to_unmap()dispatches hugetlb folios totry_to_unmap_poisoned_hugetlb_one(), sotry_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.
Quoted 23 lines
Reviewed-by Kunwu Chan <[email protected]>Thanks,
KunWuQuoted 17 lines
Signed-off-by Dev Jain <[email protected]>---
Rebase soup - myhuge_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(-)mm/rmap.c +0
-0@@ -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);
Quoted 16 lines
Quoted 12 lines
mm/rmap.c +2
-6address = 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 { --Quoted 3 lines
2.43.0
--
Cheers, Lorenzo
Quoted 12 lines · On Mon, 31 Aug 2026 17:00:56 +0100 "Lorenzo Stoakes (ARM)" <[email protected]>…
Quoted 11 lines · Kunwu Chan
Quoted 3 lines · On Mon, 31 Aug 2026 08:28:47 +0000 Dev Jain <[email protected]> wrote:
Post commit
d4ec5572825a("mm/rmap: addtry_to_unmap_poisoned_hugetlb_one")try_to_unmap_one()cannot be called with a hugetlb folio. Therefore remove thefolio_test_hugetlb()check.Yes, the
d4ec5572825change shows thattry_to_unmap()dispatches hugetlb folios totry_to_unmap_poisoned_hugetlb_one(), sotry_to_unmap_one()cannot be called with a hugetlb folio.
Quoted 7 lines
Quoted 2 lines
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
Quoted 43 lines
Quoted 23 lines
Reviewed-by Kunwu Chan <[email protected]>Thanks,
KunWuQuoted 17 lines
Signed-off-by Dev Jain <[email protected]>---
Rebase soup - myhuge_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(-)mm/rmap.c +0
-0@@ -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);Quoted 16 lines
Quoted 12 lines
mm/rmap.c +2
-6address = 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 { --Quoted 3 lines
2.43.0
--
Cheers, Lorenzo
Quoted 9 lines · Dev Jain
Post commit
d4ec5572825a("mm/rmap: addtry_to_unmap_poisoned_hugetlb_one")try_to_unmap_one()cannot be called with a hugetlb folio. Therefore remove thefolio_test_hugetlb()check.Signed-off-by Dev Jain <[email protected]>---
Rebase soup - myhuge_ptep_get()fixes landed after the refactoring.This patch applies on Linux 7.3-rc1.
Thanks!
Signature · 3 lines
Cheers, David