All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH 0/2] ksm06 fixes
@ 2022-02-28  9:46 Cyril Hrubis
  2022-02-28  9:46 ` [LTP] [PATCH 1/2] ksm06: Free memory at the end of the test Cyril Hrubis
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Cyril Hrubis @ 2022-02-28  9:46 UTC (permalink / raw)
  To: ltp

Two minor fixes for the ksm06 test.

Also it looks like the test_ksm_merge_across_nodes() is only called from
the ksm06 test so it does not make that much sense for the code to be in
the mem.c library. I guess that we should move it to the test source so
that it's not hidden in the library as well.

Cyril Hrubis (2):
  ksm06: Free memory at the end of the test
  ksm06: lock memory about to be merged

 testcases/kernel/mem/lib/mem.c | 8 ++++++++
 1 file changed, 8 insertions(+)

-- 
2.34.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [LTP] [PATCH 1/2] ksm06: Free memory at the end of the test
  2022-02-28  9:46 [LTP] [PATCH 0/2] ksm06 fixes Cyril Hrubis
@ 2022-02-28  9:46 ` Cyril Hrubis
  2022-02-28 13:14   ` Petr Vorel
  2022-02-28  9:46 ` [LTP] [PATCH 2/2] ksm06: lock memory about to be merged Cyril Hrubis
  2022-03-01  9:01 ` [LTP] [PATCH 0/2] ksm06 fixes Li Wang
  2 siblings, 1 reply; 9+ messages in thread
From: Cyril Hrubis @ 2022-02-28  9:46 UTC (permalink / raw)
  To: ltp

Fixes the kms06 run with -i 2.

Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
---
 testcases/kernel/mem/lib/mem.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/testcases/kernel/mem/lib/mem.c b/testcases/kernel/mem/lib/mem.c
index 99d5f7f53..39e3f1791 100644
--- a/testcases/kernel/mem/lib/mem.c
+++ b/testcases/kernel/mem/lib/mem.c
@@ -594,6 +594,11 @@ void test_ksm_merge_across_nodes(unsigned long nr_pages)
 		    0, 0, 0, nr_pages * num_nodes);
 
 	SAFE_FILE_PRINTF(PATH_KSM "run", "2");
+
+	for (i = 0; i < num_nodes; i++)
+		SAFE_MUNMAP(memory[i], length);
+
+	free(memory);
 }
 
 /* THP */
-- 
2.34.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [LTP] [PATCH 2/2] ksm06: lock memory about to be merged
  2022-02-28  9:46 [LTP] [PATCH 0/2] ksm06 fixes Cyril Hrubis
  2022-02-28  9:46 ` [LTP] [PATCH 1/2] ksm06: Free memory at the end of the test Cyril Hrubis
@ 2022-02-28  9:46 ` Cyril Hrubis
  2022-02-28 13:16   ` Petr Vorel
  2022-03-01  3:18   ` Li Wang
  2022-03-01  9:01 ` [LTP] [PATCH 0/2] ksm06 fixes Li Wang
  2 siblings, 2 replies; 9+ messages in thread
From: Cyril Hrubis @ 2022-02-28  9:46 UTC (permalink / raw)
  To: ltp

We have observed sporadic failures of the test in OpenQA in the case
that the memory allocated by the test is large enough (ksm06_2 runs the
test with -n 8000 which on ppc64le with 64k page size amounts to 1GB in
allocated buffers in total) and in the case of bacground load being run
while the test is executed (LTP compilation with suitable -j make
parameter suffices to trigger the conditions).

The culprit is that some of the pages may end up being swapped before
they happen to be merged due to a memory pressure caused by the
background load.

After this patch applied the test seems to be passing regardless the
background load.

Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
---
 testcases/kernel/mem/lib/mem.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/testcases/kernel/mem/lib/mem.c b/testcases/kernel/mem/lib/mem.c
index 39e3f1791..f1756b34a 100644
--- a/testcases/kernel/mem/lib/mem.c
+++ b/testcases/kernel/mem/lib/mem.c
@@ -565,6 +565,9 @@ void test_ksm_merge_across_nodes(unsigned long nr_pages)
 #endif
 
 		memset(memory[i], 10, length);
+
+		if (mlock(memory[i], length))
+			tst_res(TINFO | TERRNO, "mlock() failed");
 	}
 
 	SAFE_FILE_PRINTF(PATH_KSM "sleep_millisecs", "0");
-- 
2.34.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [LTP] [PATCH 1/2] ksm06: Free memory at the end of the test
  2022-02-28  9:46 ` [LTP] [PATCH 1/2] ksm06: Free memory at the end of the test Cyril Hrubis
@ 2022-02-28 13:14   ` Petr Vorel
  0 siblings, 0 replies; 9+ messages in thread
From: Petr Vorel @ 2022-02-28 13:14 UTC (permalink / raw)
  To: Cyril Hrubis; +Cc: ltp

Hi Cyril,

obviously correct.
Reviewed-by: Petr Vorel <pvorel@suse.cz>

> Fixes the kms06 run with -i 2.
typo: s/kms06/ksm06/g

Kind regards,
Petr

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [LTP] [PATCH 2/2] ksm06: lock memory about to be merged
  2022-02-28  9:46 ` [LTP] [PATCH 2/2] ksm06: lock memory about to be merged Cyril Hrubis
@ 2022-02-28 13:16   ` Petr Vorel
  2022-03-01  3:18   ` Li Wang
  1 sibling, 0 replies; 9+ messages in thread
From: Petr Vorel @ 2022-02-28 13:16 UTC (permalink / raw)
  To: Cyril Hrubis; +Cc: ltp

Hi Cyril,

Reviewed-by: Petr Vorel <pvorel@suse.cz>
Good catch!

> Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
> ---
>  testcases/kernel/mem/lib/mem.c | 3 +++
>  1 file changed, 3 insertions(+)

> diff --git a/testcases/kernel/mem/lib/mem.c b/testcases/kernel/mem/lib/mem.c
> index 39e3f1791..f1756b34a 100644
> --- a/testcases/kernel/mem/lib/mem.c
> +++ b/testcases/kernel/mem/lib/mem.c
> @@ -565,6 +565,9 @@ void test_ksm_merge_across_nodes(unsigned long nr_pages)
>  #endif

>  		memset(memory[i], 10, length);
> +
> +		if (mlock(memory[i], length))
> +			tst_res(TINFO | TERRNO, "mlock() failed");
I'd consider using TWARN.

Kind regards,
Petr

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [LTP] [PATCH 2/2] ksm06: lock memory about to be merged
  2022-02-28  9:46 ` [LTP] [PATCH 2/2] ksm06: lock memory about to be merged Cyril Hrubis
  2022-02-28 13:16   ` Petr Vorel
@ 2022-03-01  3:18   ` Li Wang
  2022-03-01  8:09     ` Cyril Hrubis
  1 sibling, 1 reply; 9+ messages in thread
From: Li Wang @ 2022-03-01  3:18 UTC (permalink / raw)
  To: Cyril Hrubis; +Cc: LTP List


[-- Attachment #1.1: Type: text/plain, Size: 128 bytes --]

This patchset looks pretty good if go with Petr's suggestions.

Reviewed-by: Li Wang <liwang@redhat.com>


-- 
Regards,
Li Wang

[-- Attachment #1.2: Type: text/html, Size: 643 bytes --]

[-- Attachment #2: Type: text/plain, Size: 60 bytes --]


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [LTP] [PATCH 2/2] ksm06: lock memory about to be merged
  2022-03-01  3:18   ` Li Wang
@ 2022-03-01  8:09     ` Cyril Hrubis
  0 siblings, 0 replies; 9+ messages in thread
From: Cyril Hrubis @ 2022-03-01  8:09 UTC (permalink / raw)
  To: Li Wang; +Cc: LTP List

Hi!
Fixed the typo and changed the TINFO to TWARN and pushed.

Thanks for the review.

-- 
Cyril Hrubis
chrubis@suse.cz

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [LTP] [PATCH 0/2] ksm06 fixes
  2022-02-28  9:46 [LTP] [PATCH 0/2] ksm06 fixes Cyril Hrubis
  2022-02-28  9:46 ` [LTP] [PATCH 1/2] ksm06: Free memory at the end of the test Cyril Hrubis
  2022-02-28  9:46 ` [LTP] [PATCH 2/2] ksm06: lock memory about to be merged Cyril Hrubis
@ 2022-03-01  9:01 ` Li Wang
  2022-03-01  9:26   ` Cyril Hrubis
  2 siblings, 1 reply; 9+ messages in thread
From: Li Wang @ 2022-03-01  9:01 UTC (permalink / raw)
  To: Cyril Hrubis; +Cc: LTP List


[-- Attachment #1.1: Type: text/plain, Size: 523 bytes --]

Cyril Hrubis <chrubis@suse.cz> wrote:

Two minor fixes for the ksm06 test.
>
> Also it looks like the test_ksm_merge_across_nodes() is only called from
> the ksm06 test so it does not make that much sense for the code to be in
> the mem.c library. I guess that we should move it to the test source so
> that it's not hidden in the library as well.
>

Absolutely yes, that will make mem library a bit shorten to read, we can do
that in a separate patch.
(sorry for overlooking this patch cover letter)

-- 
Regards,
Li Wang

[-- Attachment #1.2: Type: text/html, Size: 1156 bytes --]

[-- Attachment #2: Type: text/plain, Size: 60 bytes --]


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [LTP] [PATCH 0/2] ksm06 fixes
  2022-03-01  9:01 ` [LTP] [PATCH 0/2] ksm06 fixes Li Wang
@ 2022-03-01  9:26   ` Cyril Hrubis
  0 siblings, 0 replies; 9+ messages in thread
From: Cyril Hrubis @ 2022-03-01  9:26 UTC (permalink / raw)
  To: Li Wang; +Cc: LTP List

Hi!
> Absolutely yes, that will make mem library a bit shorten to read, we can do
> that in a separate patch.
> (sorry for overlooking this patch cover letter)

I will send another cleanup patchset later on, I wanted the test fixed
ASAP which is why I limited the first patchset strictly to obvious
fixes.

-- 
Cyril Hrubis
chrubis@suse.cz

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2022-03-01  9:24 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-28  9:46 [LTP] [PATCH 0/2] ksm06 fixes Cyril Hrubis
2022-02-28  9:46 ` [LTP] [PATCH 1/2] ksm06: Free memory at the end of the test Cyril Hrubis
2022-02-28 13:14   ` Petr Vorel
2022-02-28  9:46 ` [LTP] [PATCH 2/2] ksm06: lock memory about to be merged Cyril Hrubis
2022-02-28 13:16   ` Petr Vorel
2022-03-01  3:18   ` Li Wang
2022-03-01  8:09     ` Cyril Hrubis
2022-03-01  9:01 ` [LTP] [PATCH 0/2] ksm06 fixes Li Wang
2022-03-01  9:26   ` Cyril Hrubis

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.