mm/huge_memory: add pmd folio to ds_queue in do_huge_zero_wp_pmd()
Subsystems (2)
PATCH 1/1 mm/huge_memory: add pmd folio to ds_queue in do_huge_zero_wp_pmd()
We add pmd folio into ds_queue on the first page fault in __do_huge_pmd_anonymous_page(), so that we can split it in case of memory pressure. This should be the same for a pmd folio during wp page fault.
Add it as expected.
--- mm/huge_memory.c | 1 + 1 file changed, 1 insertion(+)
mm/huge_memory.c +1 -0
@@ -1878,6 +1878,7 @@ static vm_fault_t do_huge_zero_wp_pmd(struct vm_fault *vmf) goto release; (void )pmdp_huge_clear_flush (vma, haddr, vmf->pmd);map_anon_folio_pmd (folio, vmf->pmd, vma, haddr); +deferred_split_folio (folio, false); goto unlock; release:folio_put (folio);
Signature · 1 line
2.34.1
Quoted 11 lines · Wei Yang
We add pmd folio into
ds_queueon the first page fault in__do_huge_pmd_anonymous_page(), so that we can split it in case of memory pressure. This should be the same for a pmd folio during wp page fault.Add it as expected.
Signed-off-by Wei Yang <[email protected]>Cc David Hildenbrand <[email protected]>Cc Lance Yang <[email protected]>Cc Dev Jain <[email protected]>
Quoted 9 lines
--- mm/huge_memory.c | 1 + 1 file changed, 1 insertion(+)mm/huge_memory.c +0
-0
mm/huge_memory.c static vm_fault_t do_huge_zero_wp_pmd(struct vm_fault *vmf) · line 1884
Quoted 7 lines
mm/huge_memory.c +1
-0@@ -1878,6 +1878,7 @@ static vm_fault_t do_huge_zero_wp_pmd(struct vm_fault *vmf) goto release; (void )pmdp_huge_clear_flush (vma, haddr, vmf->pmd);map_anon_folio_pmd (folio, vmf->pmd, vma, haddr); +deferred_split_folio (folio, false); goto unlock; release:folio_put (folio);
Which raises the question whether the deferred_split_folio() should actually go into the map_anon_folio_pmd(). I think you should just move the one from __do_huge_pmd_anonymous_page() in there.
Signature · 3 lines
Cheers David / dhildenb
Lance Yang
reviewerQuoted 7 lines · David Hildenbrand
Quoted 6 lines · Wei Yang
We add pmd folio into
ds_queueon the first page fault in__do_huge_pmd_anonymous_page(), so that we can split it in case of memory pressure. This should be the same for a pmd folio during wp page fault.Add it as expected.
Good catch!
Quoted 12 lines
Quoted 5 lines
Signed-off-by Wei Yang <[email protected]>Cc David Hildenbrand <[email protected]>Cc Lance Yang <[email protected]>Cc Dev Jain <[email protected]>Fixes please, and I think we want CC stable.Quoted 4 lines
---
mm/huge_memory.c| 1 +1 file changed, 1 insertion(+)
Quoted 15 lines
Quoted 11 lines
mm/huge_memory.c +1
-0@@ -1878,6 +1878,7 @@ static vm_fault_t do_huge_zero_wp_pmd(struct vm_fault *vmf) goto release; (void)pmdp_huge_clear_flush(vma, haddr, vmf->pmd); map_anon_folio_pmd(folio, vmf->pmd, vma, haddr); + deferred_split_folio(folio, false); goto unlock;Quoted 2 lines
release:
folio_put(folio);Which raises the question whether the
deferred_split_folio()should actually go into themap_anon_folio_pmd(). I think you should just move the one from__do_huge_pmd_anonymous_page()in there.
+1 Moving the call into map_anon_folio_pmd() feels way cleaner :)
Cheers,
Lance
Andrew Morton
maintainerQuoted 6 lines · On Wed, 1 Oct 2025 16:34:45 +0200 David Hildenbrand <[email protected]> wrote:
Quoted 5 lines · Wei Yang
We add pmd folio into
ds_queueon the first page fault in__do_huge_pmd_anonymous_page(), so that we can split it in case of memory pressure. This should be the same for a pmd folio during wp page fault.
Quoted 8 lines
Quoted 6 lines
Add it as expected.
Signed-off-by Wei Yang <[email protected]>Cc David Hildenbrand <[email protected]>Cc Lance Yang <[email protected]>Cc Dev Jain <[email protected]>Fixes please, and I think we want CC stable.
And a reason for Fixes: and Cc:stable, please. ie, a description of the userspace visible runtime effects.
Cheers, akpmbot.