* [PATCH 1/2] selftests: mm: ksm: Fix incorrect evaluation of parameter
@ 2023-07-28 6:01 Ayush Jain
2023-07-28 6:01 ` [PATCH 2/2] selftests: mm: add KSM_MERGE_TIME tests Ayush Jain
2023-07-28 14:35 ` [PATCH 1/2] selftests: mm: ksm: Fix incorrect evaluation of parameter David Hildenbrand
0 siblings, 2 replies; 5+ messages in thread
From: Ayush Jain @ 2023-07-28 6:01 UTC (permalink / raw)
To: akpm, shuah, pasha.tatashin, zhansayabagdaulet, tyhicks,
raghavendra.kodsarathimmappa
Cc: linux-mm, linux-kselftest, linux-kernel, Narasimhan.V,
Santosh.Shukla, Ayush Jain
A missing break in kms_tests leads to kselftest hang when the
parameter -s is used.
In current code flow because of missing break in -s, -t parses
args spilled from -s and as -t accepts only valid values as 0,1
so any arg in -s >1 or <0, gets in ksm_test failure
This went undetected since, before the addition of option -t,
the next case -M would immediately break out of the switch
statement but that is no longer the case
Add the missing break statement.
----Before----
./ksm_tests -H -s 100
Invalid merge type
----After----
./ksm_tests -H -s 100
Number of normal pages: 0
Number of huge pages: 50
Total size: 100 MiB
Total time: 0.401732682 s
Average speed: 248.922 MiB/s
Fixes: 9e7cb94ca218 ("selftests: vm: add KSM merging time test")
Signed-off-by: Ayush Jain <ayush.jain3@amd.com>
---
tools/testing/selftests/mm/ksm_tests.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/testing/selftests/mm/ksm_tests.c b/tools/testing/selftests/mm/ksm_tests.c
index 435acebdc325..380b691d3eb9 100644
--- a/tools/testing/selftests/mm/ksm_tests.c
+++ b/tools/testing/selftests/mm/ksm_tests.c
@@ -831,6 +831,7 @@ int main(int argc, char *argv[])
printf("Size must be greater than 0\n");
return KSFT_FAIL;
}
+ break;
case 't':
{
int tmp = atoi(optarg);
--
2.34.1
^ permalink raw reply [flat|nested] 5+ messages in thread* [PATCH 2/2] selftests: mm: add KSM_MERGE_TIME tests
2023-07-28 6:01 [PATCH 1/2] selftests: mm: ksm: Fix incorrect evaluation of parameter Ayush Jain
@ 2023-07-28 6:01 ` Ayush Jain
2023-07-28 14:35 ` David Hildenbrand
2023-07-28 14:35 ` [PATCH 1/2] selftests: mm: ksm: Fix incorrect evaluation of parameter David Hildenbrand
1 sibling, 1 reply; 5+ messages in thread
From: Ayush Jain @ 2023-07-28 6:01 UTC (permalink / raw)
To: akpm, shuah, pasha.tatashin, zhansayabagdaulet, tyhicks,
raghavendra.kodsarathimmappa
Cc: linux-mm, linux-kselftest, linux-kernel, Narasimhan.V,
Santosh.Shukla, Ayush Jain
add KSM_MERGE_TIME and KSM_MERGE_TIME_HUGE_PAGES tests with
size of 100.
./run_vmtests.sh -t ksm
-----------------------------
running ./ksm_tests -H -s 100
-----------------------------
Number of normal pages: 0
Number of huge pages: 50
Total size: 100 MiB
Total time: 0.399844662 s
Average speed: 250.097 MiB/s
[PASS]
-----------------------------
running ./ksm_tests -P -s 100
-----------------------------
Total size: 100 MiB
Total time: 0.451931496 s
Average speed: 221.272 MiB/s
[PASS]
Signed-off-by: Ayush Jain <ayush.jain3@amd.com>
---
tools/testing/selftests/mm/run_vmtests.sh | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/tools/testing/selftests/mm/run_vmtests.sh b/tools/testing/selftests/mm/run_vmtests.sh
index 3f26f6e15b2a..ca3738e042c2 100755
--- a/tools/testing/selftests/mm/run_vmtests.sh
+++ b/tools/testing/selftests/mm/run_vmtests.sh
@@ -262,6 +262,10 @@ CATEGORY="madv_populate" run_test ./madv_populate
CATEGORY="memfd_secret" run_test ./memfd_secret
+# KSM KSM_MERGE_TIME_HUGE_PAGES test with size of 100
+CATEGORY="ksm" run_test ./ksm_tests -H -s 100
+# KSM KSM_MERGE_TIME test with size of 100
+CATEGORY="ksm" run_test ./ksm_tests -P -s 100
# KSM MADV_MERGEABLE test with 10 identical pages
CATEGORY="ksm" run_test ./ksm_tests -M -p 10
# KSM unmerge test
--
2.34.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] selftests: mm: add KSM_MERGE_TIME tests
2023-07-28 6:01 ` [PATCH 2/2] selftests: mm: add KSM_MERGE_TIME tests Ayush Jain
@ 2023-07-28 14:35 ` David Hildenbrand
0 siblings, 0 replies; 5+ messages in thread
From: David Hildenbrand @ 2023-07-28 14:35 UTC (permalink / raw)
To: Ayush Jain, akpm, shuah, pasha.tatashin, zhansayabagdaulet,
tyhicks, raghavendra.kodsarathimmappa
Cc: linux-mm, linux-kselftest, linux-kernel, Narasimhan.V, Santosh.Shukla
On 28.07.23 08:01, Ayush Jain wrote:
> add KSM_MERGE_TIME and KSM_MERGE_TIME_HUGE_PAGES tests with
> size of 100.
>
> ./run_vmtests.sh -t ksm
> -----------------------------
> running ./ksm_tests -H -s 100
> -----------------------------
> Number of normal pages: 0
> Number of huge pages: 50
> Total size: 100 MiB
> Total time: 0.399844662 s
> Average speed: 250.097 MiB/s
> [PASS]
> -----------------------------
> running ./ksm_tests -P -s 100
> -----------------------------
> Total size: 100 MiB
> Total time: 0.451931496 s
> Average speed: 221.272 MiB/s
> [PASS]
>
> Signed-off-by: Ayush Jain <ayush.jain3@amd.com>
> ---
> tools/testing/selftests/mm/run_vmtests.sh | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/tools/testing/selftests/mm/run_vmtests.sh b/tools/testing/selftests/mm/run_vmtests.sh
> index 3f26f6e15b2a..ca3738e042c2 100755
> --- a/tools/testing/selftests/mm/run_vmtests.sh
> +++ b/tools/testing/selftests/mm/run_vmtests.sh
> @@ -262,6 +262,10 @@ CATEGORY="madv_populate" run_test ./madv_populate
>
> CATEGORY="memfd_secret" run_test ./memfd_secret
>
> +# KSM KSM_MERGE_TIME_HUGE_PAGES test with size of 100
> +CATEGORY="ksm" run_test ./ksm_tests -H -s 100
> +# KSM KSM_MERGE_TIME test with size of 100
> +CATEGORY="ksm" run_test ./ksm_tests -P -s 100
> # KSM MADV_MERGEABLE test with 10 identical pages
> CATEGORY="ksm" run_test ./ksm_tests -M -p 10
> # KSM unmerge test
Reviewed-by: David Hildenbrand <david@redhat.com>
--
Cheers,
David / dhildenb
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] selftests: mm: ksm: Fix incorrect evaluation of parameter
2023-07-28 6:01 [PATCH 1/2] selftests: mm: ksm: Fix incorrect evaluation of parameter Ayush Jain
2023-07-28 6:01 ` [PATCH 2/2] selftests: mm: add KSM_MERGE_TIME tests Ayush Jain
@ 2023-07-28 14:35 ` David Hildenbrand
2023-07-28 16:15 ` Ayush Jain
1 sibling, 1 reply; 5+ messages in thread
From: David Hildenbrand @ 2023-07-28 14:35 UTC (permalink / raw)
To: Ayush Jain, akpm, shuah, pasha.tatashin, zhansayabagdaulet,
tyhicks, raghavendra.kodsarathimmappa
Cc: linux-mm, linux-kselftest, linux-kernel, Narasimhan.V, Santosh.Shukla
On 28.07.23 08:01, Ayush Jain wrote:
> A missing break in kms_tests leads to kselftest hang when the
> parameter -s is used.
> In current code flow because of missing break in -s, -t parses
> args spilled from -s and as -t accepts only valid values as 0,1
> so any arg in -s >1 or <0, gets in ksm_test failure
>
> This went undetected since, before the addition of option -t,
> the next case -M would immediately break out of the switch
> statement but that is no longer the case
>
> Add the missing break statement.
>
> ----Before----
> ./ksm_tests -H -s 100
> Invalid merge type
>
> ----After----
> ./ksm_tests -H -s 100
> Number of normal pages: 0
> Number of huge pages: 50
> Total size: 100 MiB
> Total time: 0.401732682 s
> Average speed: 248.922 MiB/s
>
> Fixes: 9e7cb94ca218 ("selftests: vm: add KSM merging time test")
I think this actually fixes 07115fcc15b4 ("selftests/mm: add new
selftests for KSM") that added the "t" parsing.
Reviewed-by: David Hildenbrand <david@redhat.com>
--
Cheers,
David / dhildenb
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH 1/2] selftests: mm: ksm: Fix incorrect evaluation of parameter
2023-07-28 14:35 ` [PATCH 1/2] selftests: mm: ksm: Fix incorrect evaluation of parameter David Hildenbrand
@ 2023-07-28 16:15 ` Ayush Jain
0 siblings, 0 replies; 5+ messages in thread
From: Ayush Jain @ 2023-07-28 16:15 UTC (permalink / raw)
To: David Hildenbrand, akpm, shuah, pasha.tatashin,
zhansayabagdaulet, tyhicks, raghavendra.kodsarathimmappa
Cc: linux-mm, linux-kselftest, linux-kernel, Narasimhan.V, Santosh.Shukla
Hello David,
On 7/28/2023 8:05 PM, David Hildenbrand wrote:
> On 28.07.23 08:01, Ayush Jain wrote:
>> A missing break in kms_tests leads to kselftest hang when the
>> parameter -s is used.
>> In current code flow because of missing break in -s, -t parses
>> args spilled from -s and as -t accepts only valid values as 0,1
>> so any arg in -s >1 or <0, gets in ksm_test failure
>>
>> This went undetected since, before the addition of option -t,
>> the next case -M would immediately break out of the switch
>> statement but that is no longer the case
>>
>> Add the missing break statement.
>>
>> ----Before----
>> ./ksm_tests -H -s 100
>> Invalid merge type
>>
>> ----After----
>> ./ksm_tests -H -s 100
>> Number of normal pages: 0
>> Number of huge pages: 50
>> Total size: 100 MiB
>> Total time: 0.401732682 s
>> Average speed: 248.922 MiB/s
>>
>> Fixes: 9e7cb94ca218 ("selftests: vm: add KSM merging time test")
>
> I think this actually fixes 07115fcc15b4 ("selftests/mm: add new selftests for KSM") that added the "t" parsing.
>
Sure will update in v2.
> Reviewed-by: David Hildenbrand <david@redhat.com>
>
Thanks,
Ayush Jain
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-07-28 16:15 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-28 6:01 [PATCH 1/2] selftests: mm: ksm: Fix incorrect evaluation of parameter Ayush Jain
2023-07-28 6:01 ` [PATCH 2/2] selftests: mm: add KSM_MERGE_TIME tests Ayush Jain
2023-07-28 14:35 ` David Hildenbrand
2023-07-28 14:35 ` [PATCH 1/2] selftests: mm: ksm: Fix incorrect evaluation of parameter David Hildenbrand
2023-07-28 16:15 ` Ayush Jain
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox