lkml.org 
[lkml]   [2023]   [Mar]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 10/29] selftests/mm: Test UFFDIO_ZEROPAGE only when !hugetlb
On 03/30/23 12:07, Peter Xu wrote:
> Make the check as simple as "test_type == TEST_HUGETLB" because that's the
> only mem that doesn't support ZEROPAGE.
>
> Signed-off-by: Peter Xu <peterx@redhat.com>
> ---
> tools/testing/selftests/mm/userfaultfd.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/mm/userfaultfd.c b/tools/testing/selftests/mm/userfaultfd.c
> index 795fbc4d84f8..d724f1c78847 100644
> --- a/tools/testing/selftests/mm/userfaultfd.c
> +++ b/tools/testing/selftests/mm/userfaultfd.c
> @@ -1118,7 +1118,7 @@ static int __uffdio_zeropage(int ufd, unsigned long offset, bool retry)
> {
> struct uffdio_zeropage uffdio_zeropage;
> int ret;
> - bool has_zeropage = get_expected_ioctls(0) & (1 << _UFFDIO_ZEROPAGE);
> + bool has_zeropage = !(test_type == TEST_HUGETLB);

It is true that hugetlb is the only mem type that does not support zeropage.
So, the change is correct.

However, I actually prefer the explicit check that is there today. It seems
more like a test of the API. And, is more future proof is code changes.

Just my opinion/thoughts, not a strong objection.
--
Mike Kravetz

\
 
 \ /
  Last update: 2023-03-31 20:38    [W:0.493 / U:0.036 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site