Skip to content

Commit ab1ffc8

Browse files
abrestic-rivosakpm00
authored andcommitted
mm/memory: don't require head page for do_set_pmd()
The requirement that the head page be passed to do_set_pmd() was added in commit ef37b2e ("mm/memory: page_add_file_rmap() -> folio_add_file_rmap_[pte|pmd]()") and prevents pmd-mapping in the finish_fault() and filemap_map_pages() paths if the page to be inserted is anything but the head page for an otherwise suitable vma and pmd-sized page. Matthew said: : We're going to stop using PMDs to map large folios unless the fault is : within the first 4KiB of the PMD. No idea how many workloads that : affects, but it only needs to be backported as far as v6.8, so we may : as well backport it. Link: https://lkml.kernel.org/r/[email protected] Fixes: ef37b2e ("mm/memory: page_add_file_rmap() -> folio_add_file_rmap_[pte|pmd]()") Signed-off-by: Andrew Bresticker <[email protected]> Acked-by: David Hildenbrand <[email protected]> Acked-by: Hugh Dickins <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent bf14ed8 commit ab1ffc8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

mm/memory.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4608,8 +4608,9 @@ vm_fault_t do_set_pmd(struct vm_fault *vmf, struct page *page)
46084608
if (!thp_vma_suitable_order(vma, haddr, PMD_ORDER))
46094609
return ret;
46104610

4611-
if (page != &folio->page || folio_order(folio) != HPAGE_PMD_ORDER)
4611+
if (folio_order(folio) != HPAGE_PMD_ORDER)
46124612
return ret;
4613+
page = &folio->page;
46134614

46144615
/*
46154616
* Just backoff if any subpage of a THP is corrupted otherwise

0 commit comments

Comments
 (0)