lkml.org 
[lkml]   [2024]   [Feb]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Subject[PATCH v2 0/5] Handle hugetlb faults under the VMA lock
Date
It is generally safe to handle hugetlb faults under the VMA lock. The
only time this is unsafe is when no anon_vma has been allocated to this
vma yet, so we can use vmf_anon_prepare() instead of anon_vma_prepare()
to bailout if necessary. This should only happen for the first hugetlb
page in the vma.

Additionally, this patchset begins to use struct vm_fault within
hugetlb_fault(). This works towards cleaning up hugetlb code, and should
significantly reduce the number of arguments passed to functions.

-----
The last patch in this series may cause ltp hugemmap10 to "fail". This
is because vmf_anon_prepare() may bailout with no anon_vma under the VMA
lock after allocating a folio for the hugepage. In free_huge_folio(),
this folio is completely freed on bailout iff there is a surplus of
hugetlb pages. This will remove a folio off the freelist and decrement
the number of hugepages while ltp expects these counters to remain
unchanged on failure. The rest of the ltp testcases pass.

v2:
- Removed unnecessary variables and indentations
- Declare struct vm_fault in hugetlb_fault and pass it down as an
argument instead of defining it in each called function.
- Moved vmf_anon_prepare() declaration to mm/internal.h from
include/linux/hugetlb.h


Vishal Moola (Oracle) (5):
mm/memory: Change vmf_anon_prepare() to be non-static
hugetlb: Move vm_struct declaration to the top of hugetlb_fault()
hugetlb: Pass struct vm_fault through to hugetlb_handle_userfault()
hugetlb: Use vmf_anon_prepare() instead of anon_vma_prepare()
hugetlb: Allow faults to be handled under the VMA lock

mm/hugetlb.c | 88 ++++++++++++++++++++-------------------------------
mm/internal.h | 1 +
mm/memory.c | 2 +-
3 files changed, 36 insertions(+), 55 deletions(-)

--
2.43.0


\
 
 \ /
  Last update: 2024-05-27 15:15    [W:2.025 / U:0.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site