* [LTP] [PATCH] move_pages12: compacting memory before each test loop
@ 2024-02-20 9:13 Li Wang
2024-02-21 16:27 ` Petr Vorel
0 siblings, 1 reply; 3+ messages in thread
From: Li Wang @ 2024-02-20 9:13 UTC (permalink / raw)
To: ltp
These simple steps are added to prepare the system's memory state
for the test, aiming to increase the test's reliability and
consistency by starting from a clean and defragmented memory state.
To reduce accidental failures on small (1.5G) RAM system:
7 tst_test.c:1558: TINFO: Timeout per run is 0h 21m 00s
8 move_pages12.c:273: TINFO: Free RAM 1542656 kB
9 move_pages12.c:289: TINFO: Increasing 16384kB hugepages pool on node 0 to 4
10 move_pages12.c:299: TINFO: Increasing 16384kB hugepages pool on node 1 to 4
11 move_pages12.c:216: TINFO: Allocating and freeing 4 hugepages on node 0
12 move_pages12.c:216: TINFO: Allocating and freeing 4 hugepages on node 1
13 move_pages12.c:207: TPASS: Bug not reproduced
14 move_pages12.c:106: TFAIL: madvise failed: ENOMEM (12)
...<repeats 741 times>...
756 move_pages12.c:207: TPASS: Bug not reproduced
Note:
This is a single hugetlb test without invoking the hugetlb-lib of LTP,
so we add the compacting memory/cache steps additionally.
Signed-off-by: Li Wang <liwang@redhat.com>
---
testcases/kernel/syscalls/move_pages/move_pages12.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/testcases/kernel/syscalls/move_pages/move_pages12.c b/testcases/kernel/syscalls/move_pages/move_pages12.c
index fd7017d79..c387a326f 100644
--- a/testcases/kernel/syscalls/move_pages/move_pages12.c
+++ b/testcases/kernel/syscalls/move_pages/move_pages12.c
@@ -154,6 +154,9 @@ static void do_test(unsigned int n)
pid_t cpid = -1;
int status;
+ SAFE_FILE_PRINTF("/proc/sys/vm/drop_caches", "3");
+ SAFE_FILE_PRINTF("/proc/sys/vm/compact_memory", "1");
+
addr = SAFE_MMAP(NULL, tcases[n].tpages * hpsz, PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_ANONYMOUS | MAP_HUGETLB, -1, 0);
--
2.40.1
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [LTP] [PATCH] move_pages12: compacting memory before each test loop
2024-02-20 9:13 [LTP] [PATCH] move_pages12: compacting memory before each test loop Li Wang
@ 2024-02-21 16:27 ` Petr Vorel
2024-02-22 3:38 ` Li Wang
0 siblings, 1 reply; 3+ messages in thread
From: Petr Vorel @ 2024-02-21 16:27 UTC (permalink / raw)
To: Li Wang; +Cc: ltp
Hi Li,
> These simple steps are added to prepare the system's memory state
> for the test, aiming to increase the test's reliability and
> consistency by starting from a clean and defragmented memory state.
> To reduce accidental failures on small (1.5G) RAM system:
> 7 tst_test.c:1558: TINFO: Timeout per run is 0h 21m 00s
> 8 move_pages12.c:273: TINFO: Free RAM 1542656 kB
> 9 move_pages12.c:289: TINFO: Increasing 16384kB hugepages pool on node 0 to 4
> 10 move_pages12.c:299: TINFO: Increasing 16384kB hugepages pool on node 1 to 4
> 11 move_pages12.c:216: TINFO: Allocating and freeing 4 hugepages on node 0
> 12 move_pages12.c:216: TINFO: Allocating and freeing 4 hugepages on node 1
> 13 move_pages12.c:207: TPASS: Bug not reproduced
> 14 move_pages12.c:106: TFAIL: madvise failed: ENOMEM (12)
> ...<repeats 741 times>...
> 756 move_pages12.c:207: TPASS: Bug not reproduced
> Note:
> This is a single hugetlb test without invoking the hugetlb-lib of LTP,
> so we add the compacting memory/cache steps additionally.
> Signed-off-by: Li Wang <liwang@redhat.com>
> ---
> testcases/kernel/syscalls/move_pages/move_pages12.c | 3 +++
> 1 file changed, 3 insertions(+)
> diff --git a/testcases/kernel/syscalls/move_pages/move_pages12.c b/testcases/kernel/syscalls/move_pages/move_pages12.c
> index fd7017d79..c387a326f 100644
> --- a/testcases/kernel/syscalls/move_pages/move_pages12.c
> +++ b/testcases/kernel/syscalls/move_pages/move_pages12.c
> @@ -154,6 +154,9 @@ static void do_test(unsigned int n)
> pid_t cpid = -1;
> int status;
> + SAFE_FILE_PRINTF("/proc/sys/vm/drop_caches", "3");
> + SAFE_FILE_PRINTF("/proc/sys/vm/compact_memory", "1");
LGTM
Reviewed-by: Petr Vorel <pvorel@suse.cz>
BTW we clear cache with /proc/sys/vm/drop_caches in quite a few files,
I wonder if it would make sense to add a helper for it. Likely not
(it's oneliner).
Kind regards,
Petr
> +
> addr = SAFE_MMAP(NULL, tcases[n].tpages * hpsz, PROT_READ | PROT_WRITE,
> MAP_PRIVATE | MAP_ANONYMOUS | MAP_HUGETLB, -1, 0);
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [LTP] [PATCH] move_pages12: compacting memory before each test loop
2024-02-21 16:27 ` Petr Vorel
@ 2024-02-22 3:38 ` Li Wang
0 siblings, 0 replies; 3+ messages in thread
From: Li Wang @ 2024-02-22 3:38 UTC (permalink / raw)
To: Petr Vorel; +Cc: ltp
Hi Petr,
On Thu, Feb 22, 2024 at 12:28 AM Petr Vorel <pvorel@suse.cz> wrote:
> Hi Li,
>
> > These simple steps are added to prepare the system's memory state
> > for the test, aiming to increase the test's reliability and
> > consistency by starting from a clean and defragmented memory state.
>
> > To reduce accidental failures on small (1.5G) RAM system:
>
> > 7 tst_test.c:1558: TINFO: Timeout per run is 0h 21m 00s
> > 8 move_pages12.c:273: TINFO: Free RAM 1542656 kB
> > 9 move_pages12.c:289: TINFO: Increasing 16384kB hugepages pool on node
> 0 to 4
> > 10 move_pages12.c:299: TINFO: Increasing 16384kB hugepages pool on
> node 1 to 4
> > 11 move_pages12.c:216: TINFO: Allocating and freeing 4 hugepages on
> node 0
> > 12 move_pages12.c:216: TINFO: Allocating and freeing 4 hugepages on
> node 1
> > 13 move_pages12.c:207: TPASS: Bug not reproduced
> > 14 move_pages12.c:106: TFAIL: madvise failed: ENOMEM (12)
> > ...<repeats 741 times>...
> > 756 move_pages12.c:207: TPASS: Bug not reproduced
>
> > Note:
> > This is a single hugetlb test without invoking the hugetlb-lib of LTP,
> > so we add the compacting memory/cache steps additionally.
>
> > Signed-off-by: Li Wang <liwang@redhat.com>
> > ---
> > testcases/kernel/syscalls/move_pages/move_pages12.c | 3 +++
> > 1 file changed, 3 insertions(+)
>
> > diff --git a/testcases/kernel/syscalls/move_pages/move_pages12.c
> b/testcases/kernel/syscalls/move_pages/move_pages12.c
> > index fd7017d79..c387a326f 100644
> > --- a/testcases/kernel/syscalls/move_pages/move_pages12.c
> > +++ b/testcases/kernel/syscalls/move_pages/move_pages12.c
> > @@ -154,6 +154,9 @@ static void do_test(unsigned int n)
> > pid_t cpid = -1;
> > int status;
>
> > + SAFE_FILE_PRINTF("/proc/sys/vm/drop_caches", "3");
> > + SAFE_FILE_PRINTF("/proc/sys/vm/compact_memory", "1");
>
> LGTM
> Reviewed-by: Petr Vorel <pvorel@suse.cz>
>
> BTW we clear cache with /proc/sys/vm/drop_caches in quite a few files,
> I wonder if it would make sense to add a helper for it. Likely not
> (it's oneliner).
>
Hmm yes, maybe better put the drop caches in the setup function,
at least release more free-mem for comparison.
# free -h
total used free shared buff/cache
available
Mem: 15Gi 5.1Gi 2.3Gi 17Mi 8.1Gi
10Gi
Swap: 11Gi 2.1Gi 9.9Gi
# echo 3 >/proc/sys/vm/drop_caches
# free -h
total used free shared buff/cache
available
Mem: 15Gi 4.9Gi 10Gi 17Mi 351Mi
10Gi
Swap: 11Gi 2.1Gi 9.9Gi
>
> Kind regards,
> Petr
>
> > +
> > addr = SAFE_MMAP(NULL, tcases[n].tpages * hpsz, PROT_READ |
> PROT_WRITE,
> > MAP_PRIVATE | MAP_ANONYMOUS | MAP_HUGETLB, -1, 0);
>
>
Pushed with minor adjustments in the order.
--
Regards,
Li Wang
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-02-22 3:39 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-20 9:13 [LTP] [PATCH] move_pages12: compacting memory before each test loop Li Wang
2024-02-21 16:27 ` Petr Vorel
2024-02-22 3:38 ` Li Wang
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.