On Fri, Jun 02, 2023 at 07:15:57PM -0700, John Hubbard wrote:
Move the uffd*() routines to their natural home. Note that ksm_functional_tests.c also depend, intentionally (due to a recent commit [1]), upon uffd-common.[ch].
Cc: David Hildenbrand david@redhat.com Cc: Peter Xu peterx@redhat.com Signed-off-by: John Hubbard jhubbard@nvidia.com
tools/testing/selftests/mm/Makefile | 7 +- tools/testing/selftests/mm/hugepage-mremap.c | 2 +- .../selftests/mm/ksm_functional_tests.c | 2 +- tools/testing/selftests/mm/uffd-common.c | 105 ++++++++++++++++++ tools/testing/selftests/mm/uffd-common.h | 12 +- tools/testing/selftests/mm/vm_util.c | 104 ----------------- tools/testing/selftests/mm/vm_util.h | 10 -- 7 files changed, 122 insertions(+), 120 deletions(-)
diff --git a/tools/testing/selftests/mm/Makefile b/tools/testing/selftests/mm/Makefile index 23af4633f0f4..a15572758954 100644 --- a/tools/testing/selftests/mm/Makefile +++ b/tools/testing/selftests/mm/Makefile @@ -109,8 +109,11 @@ include ../lib.mk $(TEST_GEN_PROGS): vm_util.c -$(OUTPUT)/uffd-stress: uffd-common.c -$(OUTPUT)/uffd-unit-tests: uffd-common.c +$(OUTPUT)/uffd-stress: uffd-common.c +$(OUTPUT)/uffd-unit-tests: uffd-common.c +$(OUTPUT)/hugepage-mremap: uffd-common.c +$(OUTPUT)/write_to_hugetlbfs: uffd-common.c +$(OUTPUT)/ksm_functional_tests: uffd-common.c
Sorry, John, I still cannot follow..
As I said before uffd-common.[ch] was for uffd stress/unit tests. I confess my fault to not have named it uffd-test-common.[ch] already.
I think it's fine to keep uffd_*() helpers in vm_util.[ch] for now, until it grows. Just like if one day we'll have a pagemap.c test we don't necessary need to move pagemap_*() helpers from vm_utils.[ch] into pagemap.[ch]. It just keeps common test helpers.
Can we avoid linking those into other tests in whatever way? Maybe renaming it to uffd-test-common.[ch] may be cleaner?