Message ID | 20220527225849.284839-4-mike.kravetz@oracle.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | hugetlb: speed up linear address scanning | expand |
On 28.05.22 00:58, Mike Kravetz wrote: > Lazy page table copying at fork time was introduced with commit > d992895ba2b2 ("Lazy page table copies in fork()"). At the time, > hugetlb was very new and did not support page faulting. As a result, > it was excluded. When full page fault support was added for hugetlb, > the exclusion was not removed. > > Simply remove the check that prevents lazy copying of hugetlb page > tables at fork. Of course, like other mappings this only applies to > shared mappings. > > Lazy page table copying at fork will be less advantageous for hugetlb > mappings because: > - There are fewer page table entries with hugetlb > - hugetlb pmds can be shared instead of copied > > In any case, completely eliminating the copy at fork time shold speed > things up. + make hugetlb less special, at least a tiny little bit Acked-by: David Hildenbrand <david@redhat.com>
On Fri, May 27, 2022 at 03:58:49PM -0700, Mike Kravetz wrote: > Lazy page table copying at fork time was introduced with commit > d992895ba2b2 ("Lazy page table copies in fork()"). At the time, > hugetlb was very new and did not support page faulting. As a result, > it was excluded. When full page fault support was added for hugetlb, > the exclusion was not removed. > > Simply remove the check that prevents lazy copying of hugetlb page > tables at fork. Of course, like other mappings this only applies to > shared mappings. > > Lazy page table copying at fork will be less advantageous for hugetlb > mappings because: > - There are fewer page table entries with hugetlb > - hugetlb pmds can be shared instead of copied > > In any case, completely eliminating the copy at fork time shold speed > things up. > > Signed-off-by: Mike Kravetz <mike.kravetz@oracle.com> Acked-by: Muchun Song <songmuchun@bytedance.com> Thanks.
diff --git a/mm/memory.c b/mm/memory.c index 21dadf03f089..f390cc11886d 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -1245,7 +1245,7 @@ vma_needs_copy(struct vm_area_struct *dst_vma, struct vm_area_struct *src_vma) if (userfaultfd_wp(dst_vma)) return true; - if (src_vma->vm_flags & (VM_HUGETLB | VM_PFNMAP | VM_MIXEDMAP)) + if (src_vma->vm_flags & (VM_PFNMAP | VM_MIXEDMAP)) return true; if (src_vma->anon_vma)
Lazy page table copying at fork time was introduced with commit d992895ba2b2 ("Lazy page table copies in fork()"). At the time, hugetlb was very new and did not support page faulting. As a result, it was excluded. When full page fault support was added for hugetlb, the exclusion was not removed. Simply remove the check that prevents lazy copying of hugetlb page tables at fork. Of course, like other mappings this only applies to shared mappings. Lazy page table copying at fork will be less advantageous for hugetlb mappings because: - There are fewer page table entries with hugetlb - hugetlb pmds can be shared instead of copied In any case, completely eliminating the copy at fork time shold speed things up. Signed-off-by: Mike Kravetz <mike.kravetz@oracle.com> --- mm/memory.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)