[PATCH v3 0/3] mm: implement and use vma_has_anon_rmap(), silence KCSAN

Lorenzo Stoakes (ARM) posted 3 patches 1 week ago
include/linux/mmap_lock.h         |  12 ++--
mm/huge_memory.c                  |  21 +++----
mm/hugetlb.c                      |   2 +-
mm/internal.h                     |   2 +-
mm/khugepaged.c                   |  17 ++---
mm/ksm.c                          |  16 ++---
mm/madvise.c                      |  10 +--
mm/memory.c                       |  16 ++---
mm/migrate.c                      |  12 ++--
mm/mmap.c                         |   6 +-
mm/mprotect.c                     |   6 +-
mm/mremap.c                       |  10 +--
mm/pgtable-generic.c              |   2 +-
mm/rmap.c                         |  22 +++----
mm/swapfile.c                     |   2 +-
mm/userfaultfd.c                  |  12 ++--
mm/vma.c                          | 127 +++++++++++++++++++-------------------
mm/vma.h                          |  29 ++++++++-
tools/testing/vma/include/dup.h   |   2 +-
tools/testing/vma/include/stubs.h |   4 ++
20 files changed, 182 insertions(+), 148 deletions(-)
[PATCH v3 0/3] mm: implement and use vma_has_anon_rmap(), silence KCSAN
Posted by Lorenzo Stoakes (ARM) 1 week ago
Provide a function to abstract the common task of checking whether
a VMA has an anonymous reverse mapping associated with it.

In the first patch, const-ify vma_assert_stabilised() and related
functions so that vma_has_anon_rmap() can reference a const vma pointer.

In the second patch, introduce vma_has_anon_rmap().

Finally in the third patch, update comments referencing anon_vma to instead
reference the anon rmap to abstract this conceptually to avoid confusion.

There are still other functions which reference anon_vma directly, those
can be addressed in a follow up.

Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
---
v3:
- Updated tags (thanks everybody!)
- Separated out const-ification changes as per Kiryl and Pedro.
- Renamed vma_anon_tracked() to vma_has_anon_rmap() as per Kiryl and Pedro.
- Converted the missed hugepage_vma_revalidate() and vma_needs_copy() callers
  as per Kiryl.
- Update the kdoc comment for vma_has_anon_rmap() to highlight that it implies
  anon folios may be associated with the VMA, as per David.
- Updated anon_vma comments as per David.
- Updated the vma_has_anon_rmap() patch commit message to avoid saying
fault as per David.
- Various prose improvements.

v2:
- Renamed vma_is_faulted() to vma_anon_tracked() as per David.
https://lore.kernel.org/r/20260910-vma-is-faulted-v2-1-e81ebc7d146b@kernel.org

v1:
https://lore.kernel.org/r/20260909-vma-is-faulted-v1-1-3a701f48984a@kernel.org

---
Lorenzo Stoakes (ARM) (3):
      mm/vma: const-ify vma_assert_stabilised() and associated functions
      mm: implement and use vma_has_anon_rmap(), silence KCSAN
      mm: update comments to refer to anon rmap rather than anon_vma

 include/linux/mmap_lock.h         |  12 ++--
 mm/huge_memory.c                  |  21 +++----
 mm/hugetlb.c                      |   2 +-
 mm/internal.h                     |   2 +-
 mm/khugepaged.c                   |  17 ++---
 mm/ksm.c                          |  16 ++---
 mm/madvise.c                      |  10 +--
 mm/memory.c                       |  16 ++---
 mm/migrate.c                      |  12 ++--
 mm/mmap.c                         |   6 +-
 mm/mprotect.c                     |   6 +-
 mm/mremap.c                       |  10 +--
 mm/pgtable-generic.c              |   2 +-
 mm/rmap.c                         |  22 +++----
 mm/swapfile.c                     |   2 +-
 mm/userfaultfd.c                  |  12 ++--
 mm/vma.c                          | 127 +++++++++++++++++++-------------------
 mm/vma.h                          |  29 ++++++++-
 tools/testing/vma/include/dup.h   |   2 +-
 tools/testing/vma/include/stubs.h |   4 ++
 20 files changed, 182 insertions(+), 148 deletions(-)
---
base-commit: b02c77c78ff74d3d88ea614335ae833e01ed5d30
change-id: 20260909-vma-is-faulted-3ed004535970

Best regards,
-- 
Lorenzo Stoakes (ARM) <ljs@kernel.org>