Skip to content

RFC Make anon_vma operations testable

Wei Yang linux-mm 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest5 patches 23 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5mm: move anon_vma manipulation functions to own fileMAINTAINERS include/linux/anon_vma.h include/linux/rmap.h +4 more+578 -5380 replies
2/5anon_vma: add skeleton code for userland testing of anon_vma logictools/include/linux/rwsem.h tools/include/linux/slab.h tools/testing/anon_vma/.gitignore +11 more+734 -03 replies
3/5anon_vma: add test for mergeable anon_vmatools/testing/anon_vma/anon_vma.c tools/testing/anon_vma/anon_vma_internal.h+183 -10 replies
4/5anon_vma: add test for reusable anon_vmatools/testing/anon_vma/anon_vma.c+141 -00 replies
5/5anon_vma: add test to assert no double-reusetools/testing/anon_vma/anon_vma.c+46 -10 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC Patch 0/5] Make anon_vma operations testable

There are several anon_vma manipulation functions implemented in mm/rmap.c, those concerning anon_vma preparing, cloning and forking, which logically could be stand-alone.

This patch series isolates anon_vma manipulation functionality into its own file, mm/anon_vma.c, and provides an API to the rest of the kernel in include/linux/anon_vma.h.

It also introduce mm/anon_vma_internal.h, which specifies which headers need to be imported by anon_vma.c, leading to the very useful property that anon_vma.c depends only on include/linux/anon_vma.h and mm/anon_vma_internal.h.

This means we can then re-implement anon_vma_internal.h in userland, adding shims for kernel mechanisms as required, allowing us to unit test internal anon_vma functionality.

This patch series takes advantage of existing shim logic and full userland interval tree support contained in tools/testing/rbtree/ and tools/include/linux/.

Kernel functionality is stubbed and shimmed as needed in tools/testing/anon_vma/ which contains a fully functional userland anon_vma_internal.h file and which imports mm/anon_vma.c to be directly tested from userland.

Patch 1 split anon_vma related logic to mm/anon_vma.c Patch 2 add a simple skeleton testing on simple fault and fork Patch 3/4 add tests for mergeable and reusable anon_vma Patch 5 assert the anon_vma double-reuse is fixed

Wei Yang (5):
mm: move anon_vma manipulation functions to own file
anon_vma: add skeleton code for userland testing of anon_vma logic
anon_vma: add test for mergeable anon_vma
anon_vma: add test for reusable anon_vma
anon_vma: add test to assert no double-reuse

 MAINTAINERS                                |   3 +
 include/linux/anon_vma.h                   | 163 +++++
 include/linux/rmap.h                       | 147 +---
 mm/Makefile                                |   2 +-
 mm/anon_vma.c                              | 396 +++++++++++
 mm/anon_vma_internal.h                     |  14 +
 mm/rmap.c                                  | 391 -----------
 tools/include/linux/rwsem.h                |  10 +
 tools/include/linux/slab.h                 |   4 +
 tools/testing/anon_vma/.gitignore          |   3 +
 tools/testing/anon_vma/Makefile            |  25 +
 tools/testing/anon_vma/anon_vma.c          | 773 +++++++++++++++++++++
 tools/testing/anon_vma/anon_vma_internal.h |  88 +++
 tools/testing/anon_vma/interval_tree.c     |  53 ++
 tools/testing/anon_vma/linux/atomic.h      |  18 +
 tools/testing/anon_vma/linux/fs.h          |   6 +
 tools/testing/anon_vma/linux/mm.h          |  44 ++
 tools/testing/anon_vma/linux/mm_types.h    |  57 ++
 tools/testing/anon_vma/linux/mmzone.h      |   6 +
 tools/testing/anon_vma/linux/rmap.h        |   8 +
 tools/testing/shared/linux/anon_vma.h      |   7 +
 21 files changed, 1680 insertions(+), 538 deletions(-)
 create mode 100644 include/linux/anon_vma.h
 create mode 100644 mm/anon_vma.c
 create mode 100644 mm/anon_vma_internal.h
 create mode 100644 tools/testing/anon_vma/.gitignore
 create mode 100644 tools/testing/anon_vma/Makefile
 create mode 100644 tools/testing/anon_vma/anon_vma.c
 create mode 100644 tools/testing/anon_vma/anon_vma_internal.h
 create mode 100644 tools/testing/anon_vma/interval_tree.c
 create mode 100644 tools/testing/anon_vma/linux/atomic.h
 create mode 100644 tools/testing/anon_vma/linux/fs.h
 create mode 100644 tools/testing/anon_vma/linux/mm.h
 create mode 100644 tools/testing/anon_vma/linux/mm_types.h
 create mode 100644 tools/testing/anon_vma/linux/mmzone.h
 create mode 100644 tools/testing/anon_vma/linux/rmap.h
 create mode 100644 tools/testing/shared/linux/anon_vma.h
Signature · 1 line
2.34.1