public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Richard Palethorpe <rpalethorpe@suse.de>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v2 2/3] oom: enable lite == 1 for memory.swap.max testing
Date: Tue, 22 Jun 2021 15:23:50 +0100	[thread overview]
Message-ID: <874kdq566h.fsf@suse.de> (raw)
In-Reply-To: <20210622122538.402907-2-liwang@redhat.com>

Hello Li,

Li Wang <liwang@redhat.com> writes:

> oom03: adding print info and restore memory.swap.max after testing
> oom05: enable lite == 1 for memory.swap.max testing
>
> Signed-off-by: Li Wang <liwang@redhat.com>
> ---
>  testcases/kernel/mem/oom/oom03.c | 6 ++++++
>  testcases/kernel/mem/oom/oom05.c | 8 ++++++--
>  2 files changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/testcases/kernel/mem/oom/oom03.c b/testcases/kernel/mem/oom/oom03.c
> index 89d7711a5..6728e1ddb 100644
> --- a/testcases/kernel/mem/oom/oom03.c
> +++ b/testcases/kernel/mem/oom/oom03.c
> @@ -46,6 +46,7 @@ static void verify_oom(void)
>  	testoom(0, 0, ENOMEM, 1);
>  
>  	if (SAFE_CGROUP_HAS(cg, "memory.swap.max")) {
> +		tst_res(TINFO, "OOM on MEMCG with special memswap limitation:");
>  		/*
>  		 * Cgroup v2 tracks memory and swap in separate, which splits
>  		 * memory and swap counter. So with swappiness enable (default
> @@ -63,6 +64,11 @@ static void verify_oom(void)
>  			SAFE_CGROUP_PRINTF(cg, "memory.swap.max", "%lu", TESTMEM);
>  
>  		testoom(0, 1, ENOMEM, 1);
> +
> +		if (TST_CGROUP_VER(cg, "memory") == TST_CGROUP_V1)
> +			SAFE_CGROUP_PRINTF(cg, "memory.swap.max", "%lu", ~0UL);
> +		else
> +			SAFE_CGROUP_PRINT(cg, "memory.swap.max", "max");
>  	}
>  
>  	/* OOM for MEMCG with mempolicy */
> diff --git a/testcases/kernel/mem/oom/oom05.c b/testcases/kernel/mem/oom/oom05.c
> index 9c9bba7f6..9e1cff312 100644
> --- a/testcases/kernel/mem/oom/oom05.c
> +++ b/testcases/kernel/mem/oom/oom05.c
> @@ -63,8 +63,12 @@ static void verify_oom(void)
>  	if (SAFE_CGROUP_HAS(cg, "memory.swap.max")) {
>  		tst_res(TINFO, "OOM on CPUSET & MEMCG with "
>  				"special memswap limitation:");
> -		SAFE_CGROUP_PRINTF(cg, "memory.swap.max", "%lu", TESTMEM);
> -		testoom(0, 0, ENOMEM, 1);
> +		if (TST_CGROUP_VER(cg, "memory") != TST_CGROUP_V1)
> +			SAFE_CGROUP_PRINTF(cg, "memory.swap.max", "%lu", MB);
> +		else
> +			SAFE_CGROUP_PRINTF(cg, "memory.swap.max", "%lu", TESTMEM);

Again; TESTMEM + MB?
> +
> +		testoom(0, 1, ENOMEM, 1);
>  
>  		tst_res(TINFO, "OOM on CPUSET & MEMCG with "
>  				"disabled memswap limitation:");
> -- 
> 2.31.1


-- 
Thank you,
Richard.

  reply	other threads:[~2021-06-22 14:23 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-22 12:25 [LTP] [PATCH v2 1/3] mem: child alloc memory should larger than memory.max + memory.swap.max if lite==1 Li Wang
2021-06-22 12:25 ` [LTP] [PATCH v2 2/3] oom: enable lite == 1 for memory.swap.max testing Li Wang
2021-06-22 14:23   ` Richard Palethorpe [this message]
2021-06-22 12:25 ` [LTP] [PATCH v2 3/3] tst_cgroup: make use of alias in safe_cgroup_has Li Wang
2021-06-22 13:40   ` Richard Palethorpe
2021-06-22 14:17 ` [LTP] [PATCH v2 1/3] mem: child alloc memory should larger than memory.max + memory.swap.max if lite==1 Richard Palethorpe
2021-06-23  2:10   ` Li Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=874kdq566h.fsf@suse.de \
    --to=rpalethorpe@suse.de \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox