Re: [PATCH 07/29] selftests/mm: Merge default_huge_page_size() into one

Peter Xu
2023-04-03T15:17:13Z

On Fri, Mar 31, 2023 at 11:15:35AM -0700, Mike Kravetz wrote:
> On 03/30/23 12:07, Peter Xu wrote:
> > There're already 3 same definitions of the three functions. Move it into
> > vm_util.[ch].
> >
> > Signed-off-by: Peter Xu <peterx@redhat.com>
> > ---
> > tools/testing/selftests/mm/hugetlb-madvise.c | 25 +-------------------
> > tools/testing/selftests/mm/thuge-gen.c | 19 +--------------
> > tools/testing/selftests/mm/userfaultfd.c | 24 -------------------
> > tools/testing/selftests/mm/vm_util.c | 21 ++++++++++++++++
> > tools/testing/selftests/mm/vm_util.h | 1 +
> > 5 files changed, 24 insertions(+), 66 deletions(-)
>
> Thanks!
>
> Some of those copies were make by me. Sorry.
>
> Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com>

Thanks!

>
> BTW - The same code (even with '... copied from mlock2-tests.c) resides
> in the selftests/memfd directory. I did that as well. :( Suspect it is OK
> to leave the copy there. But, it does make me wonder why memfd is not in
> the mm directory?

I don't know either, I suspect it was just a personal preference when it
was firstly introduced in:

commit 4f5ce5e8d7e2da3c714df8a7fa42edb9f992fc52
Author: David Herrmann <dh.herrmann@gmail.com>
Date: Fri Aug 8 14:25:32 2014 -0700

selftests: add memfd_create() + sealing tests

So I left all those alone for now. Logically they should be merged into mm/
indeed, perhaps in some future cleanups.

--
Peter Xu