* [PATCH] selftests/mm: fix split huge page tests
@ 2023-03-06 16:09 Zi Yan
2023-03-06 18:31 ` Zach O'Keefe
2023-03-07 10:22 ` David Hildenbrand
0 siblings, 2 replies; 4+ messages in thread
From: Zi Yan @ 2023-03-06 16:09 UTC (permalink / raw)
To: Andrew Morton, linux-mm
Cc: Zi Yan, linux-kernel, linux-kselftest, Shuah Khan, Zach O'Keefe
From: Zi Yan <ziy@nvidia.com>
Fixed two inputs to check_anon_huge() and one if condition, so the tests
work as expected.
Fixes: c07c343cda8e ("selftests/vm: dedup THP helpers")
Signed-off-by: Zi Yan <ziy@nvidia.com>
Cc: Zach O'Keefe <zokeefe@google.com>
---
tools/testing/selftests/mm/split_huge_page_test.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tools/testing/selftests/mm/split_huge_page_test.c b/tools/testing/selftests/mm/split_huge_page_test.c
index 76e1c36dd9e5..b8558c7f1a39 100644
--- a/tools/testing/selftests/mm/split_huge_page_test.c
+++ b/tools/testing/selftests/mm/split_huge_page_test.c
@@ -106,7 +106,7 @@ void split_pmd_thp(void)
for (i = 0; i < len; i++)
one_page[i] = (char)i;
- if (!check_huge_anon(one_page, 1, pmd_pagesize)) {
+ if (!check_huge_anon(one_page, 4, pmd_pagesize)) {
printf("No THP is allocated\n");
exit(EXIT_FAILURE);
}
@@ -122,7 +122,7 @@ void split_pmd_thp(void)
}
- if (check_huge_anon(one_page, 0, pmd_pagesize)) {
+ if (!check_huge_anon(one_page, 0, pmd_pagesize)) {
printf("Still AnonHugePages not split\n");
exit(EXIT_FAILURE);
}
@@ -169,7 +169,7 @@ void split_pte_mapped_thp(void)
for (i = 0; i < len; i++)
one_page[i] = (char)i;
- if (!check_huge_anon(one_page, 1, pmd_pagesize)) {
+ if (!check_huge_anon(one_page, 4, pmd_pagesize)) {
printf("No THP is allocated\n");
exit(EXIT_FAILURE);
}
--
2.39.2
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] selftests/mm: fix split huge page tests
2023-03-06 16:09 [PATCH] selftests/mm: fix split huge page tests Zi Yan
@ 2023-03-06 18:31 ` Zach O'Keefe
2023-03-06 18:32 ` Zi Yan
2023-03-07 10:22 ` David Hildenbrand
1 sibling, 1 reply; 4+ messages in thread
From: Zach O'Keefe @ 2023-03-06 18:31 UTC (permalink / raw)
To: Zi Yan; +Cc: Andrew Morton, linux-mm, linux-kernel, linux-kselftest, Shuah Khan
On Mar 06 11:09, Zi Yan wrote:
> From: Zi Yan <ziy@nvidia.com>
>
> Fixed two inputs to check_anon_huge() and one if condition, so the tests
> work as expected.
>
> Fixes: c07c343cda8e ("selftests/vm: dedup THP helpers")
> Signed-off-by: Zi Yan <ziy@nvidia.com>
> Cc: Zach O'Keefe <zokeefe@google.com>
> ---
> tools/testing/selftests/mm/split_huge_page_test.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/tools/testing/selftests/mm/split_huge_page_test.c b/tools/testing/selftests/mm/split_huge_page_test.c
> index 76e1c36dd9e5..b8558c7f1a39 100644
> --- a/tools/testing/selftests/mm/split_huge_page_test.c
> +++ b/tools/testing/selftests/mm/split_huge_page_test.c
> @@ -106,7 +106,7 @@ void split_pmd_thp(void)
> for (i = 0; i < len; i++)
> one_page[i] = (char)i;
>
> - if (!check_huge_anon(one_page, 1, pmd_pagesize)) {
> + if (!check_huge_anon(one_page, 4, pmd_pagesize)) {
> printf("No THP is allocated\n");
> exit(EXIT_FAILURE);
> }
> @@ -122,7 +122,7 @@ void split_pmd_thp(void)
> }
>
>
> - if (check_huge_anon(one_page, 0, pmd_pagesize)) {
> + if (!check_huge_anon(one_page, 0, pmd_pagesize)) {
> printf("Still AnonHugePages not split\n");
> exit(EXIT_FAILURE);
> }
> @@ -169,7 +169,7 @@ void split_pte_mapped_thp(void)
> for (i = 0; i < len; i++)
> one_page[i] = (char)i;
>
> - if (!check_huge_anon(one_page, 1, pmd_pagesize)) {
> + if (!check_huge_anon(one_page, 4, pmd_pagesize)) {
> printf("No THP is allocated\n");
> exit(EXIT_FAILURE);
> }
> --
> 2.39.2
>
Thanks Zi -- I had this in my TODO-log, but was slow to get it it -- apologies
for the clearly buggy code, and thanks for the cleanup. I've ran these tests to
confirm (as I should have previously), and it all looks good. Can have either my
Reviewed-by: Zach O'Keefe <zokeefe@google.com>
Tested-by: Zach O'Keefe <zokeefe@google.com>
I don't know which is more appropriate.
Best,
Zach
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] selftests/mm: fix split huge page tests
2023-03-06 18:31 ` Zach O'Keefe
@ 2023-03-06 18:32 ` Zi Yan
0 siblings, 0 replies; 4+ messages in thread
From: Zi Yan @ 2023-03-06 18:32 UTC (permalink / raw)
To: Zach O'Keefe
Cc: Andrew Morton, linux-mm, linux-kernel, linux-kselftest, Shuah Khan
[-- Attachment #1: Type: text/plain, Size: 2083 bytes --]
On 6 Mar 2023, at 13:31, Zach O'Keefe wrote:
> On Mar 06 11:09, Zi Yan wrote:
>> From: Zi Yan <ziy@nvidia.com>
>>
>> Fixed two inputs to check_anon_huge() and one if condition, so the tests
>> work as expected.
>>
>> Fixes: c07c343cda8e ("selftests/vm: dedup THP helpers")
>> Signed-off-by: Zi Yan <ziy@nvidia.com>
>> Cc: Zach O'Keefe <zokeefe@google.com>
>> ---
>> tools/testing/selftests/mm/split_huge_page_test.c | 6 +++---
>> 1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/tools/testing/selftests/mm/split_huge_page_test.c b/tools/testing/selftests/mm/split_huge_page_test.c
>> index 76e1c36dd9e5..b8558c7f1a39 100644
>> --- a/tools/testing/selftests/mm/split_huge_page_test.c
>> +++ b/tools/testing/selftests/mm/split_huge_page_test.c
>> @@ -106,7 +106,7 @@ void split_pmd_thp(void)
>> for (i = 0; i < len; i++)
>> one_page[i] = (char)i;
>>
>> - if (!check_huge_anon(one_page, 1, pmd_pagesize)) {
>> + if (!check_huge_anon(one_page, 4, pmd_pagesize)) {
>> printf("No THP is allocated\n");
>> exit(EXIT_FAILURE);
>> }
>> @@ -122,7 +122,7 @@ void split_pmd_thp(void)
>> }
>>
>>
>> - if (check_huge_anon(one_page, 0, pmd_pagesize)) {
>> + if (!check_huge_anon(one_page, 0, pmd_pagesize)) {
>> printf("Still AnonHugePages not split\n");
>> exit(EXIT_FAILURE);
>> }
>> @@ -169,7 +169,7 @@ void split_pte_mapped_thp(void)
>> for (i = 0; i < len; i++)
>> one_page[i] = (char)i;
>>
>> - if (!check_huge_anon(one_page, 1, pmd_pagesize)) {
>> + if (!check_huge_anon(one_page, 4, pmd_pagesize)) {
>> printf("No THP is allocated\n");
>> exit(EXIT_FAILURE);
>> }
>> --
>> 2.39.2
>>
>
> Thanks Zi -- I had this in my TODO-log, but was slow to get it it -- apologies
> for the clearly buggy code, and thanks for the cleanup. I've ran these tests to
> confirm (as I should have previously), and it all looks good. Can have either my
>
> Reviewed-by: Zach O'Keefe <zokeefe@google.com>
> Tested-by: Zach O'Keefe <zokeefe@google.com>
>
Thanks.
--
Best Regards,
Yan, Zi
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 854 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] selftests/mm: fix split huge page tests
2023-03-06 16:09 [PATCH] selftests/mm: fix split huge page tests Zi Yan
2023-03-06 18:31 ` Zach O'Keefe
@ 2023-03-07 10:22 ` David Hildenbrand
1 sibling, 0 replies; 4+ messages in thread
From: David Hildenbrand @ 2023-03-07 10:22 UTC (permalink / raw)
To: Zi Yan, Andrew Morton, linux-mm
Cc: linux-kernel, linux-kselftest, Shuah Khan, Zach O'Keefe
On 06.03.23 17:09, Zi Yan wrote:
> From: Zi Yan <ziy@nvidia.com>
>
> Fixed two inputs to check_anon_huge() and one if condition, so the tests
> work as expected.
>
> Fixes: c07c343cda8e ("selftests/vm: dedup THP helpers")
> Signed-off-by: Zi Yan <ziy@nvidia.com>
> Cc: Zach O'Keefe <zokeefe@google.com>
> ---
> tools/testing/selftests/mm/split_huge_page_test.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/tools/testing/selftests/mm/split_huge_page_test.c b/tools/testing/selftests/mm/split_huge_page_test.c
> index 76e1c36dd9e5..b8558c7f1a39 100644
> --- a/tools/testing/selftests/mm/split_huge_page_test.c
> +++ b/tools/testing/selftests/mm/split_huge_page_test.c
> @@ -106,7 +106,7 @@ void split_pmd_thp(void)
> for (i = 0; i < len; i++)
> one_page[i] = (char)i;
>
> - if (!check_huge_anon(one_page, 1, pmd_pagesize)) {
> + if (!check_huge_anon(one_page, 4, pmd_pagesize)) {
> printf("No THP is allocated\n");
> exit(EXIT_FAILURE);
> }
> @@ -122,7 +122,7 @@ void split_pmd_thp(void)
> }
>
>
> - if (check_huge_anon(one_page, 0, pmd_pagesize)) {
> + if (!check_huge_anon(one_page, 0, pmd_pagesize)) {
> printf("Still AnonHugePages not split\n");
> exit(EXIT_FAILURE);
> }
> @@ -169,7 +169,7 @@ void split_pte_mapped_thp(void)
> for (i = 0; i < len; i++)
> one_page[i] = (char)i;
>
> - if (!check_huge_anon(one_page, 1, pmd_pagesize)) {
> + if (!check_huge_anon(one_page, 4, pmd_pagesize)) {
> printf("No THP is allocated\n");
> exit(EXIT_FAILURE);
> }
Hard to read. It should probably be "get_huge_anon()" to then check for
the value in the caller manually. Negative value could be used as an
indicator for an error obtaining the value.
Anyhow, was briefly confused about the 4 ("magic value" also apprearing
in "size_t len = 4 * pmd_pagesize;") but it seems to be the right thing
to do.
Acked-by: David Hildenbrand <david@redhat.com>
--
Thanks,
David / dhildenb
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-03-07 10:22 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-06 16:09 [PATCH] selftests/mm: fix split huge page tests Zi Yan
2023-03-06 18:31 ` Zach O'Keefe
2023-03-06 18:32 ` Zi Yan
2023-03-07 10:22 ` David Hildenbrand
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox