diff options
| author | Peter Xu <[email protected]> | 2022-12-16 15:52:29 +0000 |
|---|---|---|
| committer | Andrew Morton <[email protected]> | 2023-01-19 01:12:39 +0000 |
| commit | 9c67a20704e763f9cb8cd262c3e45de7bd2816bc (patch) | |
| tree | fdec60daf74de68c3498e5aa40d514cd21f99914 /fs/buffer.c | |
| parent | mm/hugetlb: make walk_hugetlb_range() safe to pmd unshare (diff) | |
| download | kernel-9c67a20704e763f9cb8cd262c3e45de7bd2816bc.tar.gz kernel-9c67a20704e763f9cb8cd262c3e45de7bd2816bc.zip | |
mm/hugetlb: introduce hugetlb_walk()
huge_pte_offset() is the main walker function for hugetlb pgtables. The
name is not really representing what it does, though.
Instead of renaming it, introduce a wrapper function called hugetlb_walk()
which will use huge_pte_offset() inside. Assert on the locks when walking
the pgtable.
Note, the vma lock assertion will be a no-op for private mappings.
Document the last special case in the page_vma_mapped_walk() path where we
don't need any more lock to call hugetlb_walk().
Taking vma lock there is not needed because either: (1) potential callers
of hugetlb pvmw holds i_mmap_rwsem already (from one rmap_walk()), or (2)
the caller will not walk a hugetlb vma at all so the hugetlb code path not
reachable (e.g. in ksm or uprobe paths).
It's slightly implicit for future page_vma_mapped_walk() callers on that
lock requirement. But anyway, when one day this rule breaks, one will get
a straightforward warning in hugetlb_walk() with lockdep, then there'll be
a way out.
[[email protected]: coding-style cleanups]
Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Peter Xu <[email protected]>
Reviewed-by: Mike Kravetz <[email protected]>
Reviewed-by: John Hubbard <[email protected]>
Reviewed-by: David Hildenbrand <[email protected]>
Cc: Andrea Arcangeli <[email protected]>
Cc: James Houghton <[email protected]>
Cc: Jann Horn <[email protected]>
Cc: Miaohe Lin <[email protected]>
Cc: Muchun Song <[email protected]>
Cc: Nadav Amit <[email protected]>
Cc: Rik van Riel <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Diffstat (limited to 'fs/buffer.c')
0 files changed, 0 insertions, 0 deletions
