Re: [RFC PATCH v2 4/7] mm: move internal core VMA manipulation functions to own file
From: Lorenzo Stoakes
Date: Wed Jul 03 2024 - 06:22:55 EST
On Tue, Jul 02, 2024 at 01:38:58PM GMT, Liam R. Howlett wrote:
> * Lorenzo Stoakes <lstoakes@xxxxxxxxx> [240628 10:35]:
> > This patch introduces vma.c and moves internal core VMA manipulation
> > functions to this file from mmap.c.
> >
> > This allows us to isolate VMA functionality in a single place such that we
> > can create userspace testing code that invokes this functionality in an
> > environment where we can implement simple unit tests of core functionality.
> >
> > This patch ensures that core VMA functionality is explicitly marked as such
> > by its presence in mm/vma.h.
> >
> > It also places the header includes required by vma.c in vma_internal.h,
> > which is simply imported by vma.c. This makes the VMA functionality
> > testable, as userland testing code can simply stub out functionality
> > as required.
> >
> > Signed-off-by: Lorenzo Stoakes <lstoakes@xxxxxxxxx>
> > ---
> > include/linux/mm.h | 35 -
> > mm/Makefile | 2 +-
> > mm/internal.h | 236 +-----
> > mm/mmap.c | 1981 +++-----------------------------------------
> > mm/mmu_notifier.c | 2 +
> > mm/vma.c | 1766 +++++++++++++++++++++++++++++++++++++++
> > mm/vma.h | 362 ++++++++
> > mm/vma_internal.h | 52 ++
> > 8 files changed, 2293 insertions(+), 2143 deletions(-)
> > create mode 100644 mm/vma.c
> > create mode 100644 mm/vma.h
> > create mode 100644 mm/vma_internal.h
> >
>
> ...
>
> > diff --git a/mm/mmap.c b/mm/mmap.c
> > index d2eebbed87b9..721870f380bf 100644
> > --- a/mm/mmap.c
> > +++ b/mm/mmap.c
> > @@ -57,6 +57,7 @@
> > #include <trace/events/mmap.h>
> >
> > #include "internal.h"
> > +#include "vma.h"
>
> This isn't needed as internal.h includes vma.h in this revision.
Ugh yeah thought I caught all of them but clearly not. Will fix!
>
> >
> > #ifndef arch_mmap_check
> > #define arch_mmap_check(addr, len, flags) (0)
>
> ...
>
> Thanks,
> Liam