Re: [PATCH 10/12] selftests/mm: move uffd* routines from vm_util.c to uffd-common.c

From: John Hubbard
Date: Fri Jun 02 2023 - 18:52:27 EST


On 6/2/23 15:38, Peter Xu wrote:
...
I'm fine to move it over if you think proper, but just to mention I had
those in vm_utils.h just because I left all uffd specific tests shared code
in uffd-common.h, so my plan was uffd-common.h shouldn't be included in
most test cases except uffd tests.

I think we're in agreement that we want to only include uffd-common.h
where it's actually required. Likewise with the uffd*() routines. So I
would like to still move this over, yes, just to have things in their
best-named location.

Sorry I didn't get it - e.g. I'm confused why we need to export
uffd_test_ops into ksm unit test, it doesn't make much sense to me..

Oh, I see what you mean, finally. Yes. ksm should not need that.


If you think vm_util.h is a name too common to contain uffd helpers, shall

Right, given the presence of uffd-common.[chg], I really want to avoid putting
the uffd helpers somewhere else...

we create another vm_util_uffd.h just to put the uffd helpers?

Just see what's there in uffd-common.h, which is still ugly (I could look
into it some other day):

Good point.


extern unsigned long nr_cpus, nr_pages, nr_pages_per_cpu, page_size;
extern char *area_src, *area_src_alias, *area_dst, *area_dst_alias, *area_remap;
extern int uffd, uffd_flags, finished, *pipefd, test_type;
extern bool map_shared;
extern bool test_uffdio_wp;
extern unsigned long long *count_verify;
extern volatile bool test_uffdio_copy_eexist;

extern uffd_test_ops_t anon_uffd_test_ops;
extern uffd_test_ops_t shmem_uffd_test_ops;
extern uffd_test_ops_t hugetlb_uffd_test_ops;
extern uffd_test_ops_t *uffd_test_ops;

and more.

That's why I think this header should not better be included by anyone else
besides uffd-stress.c and uffd-unit-tests.c for now.


OK, I think I can arrange things to meet that requirement. Let me
take another shot at it.


thanks,
--
John Hubbard
NVIDIA