All of lore.kernel.org
 help / color / mirror / Atom feed
From: ZhoupingLiu <zliu@redhat.com>
To: Caspar Zhang <czhang@redhat.com>
Cc: LTP List <ltp-list@lists.sourceforge.net>, Cai Qian <caiqian@redhat.com>
Subject: Re: [LTP] [PATCH] mem/oom: avoid unexpected error when no memcg swap accounting
Date: Mon, 19 Mar 2012 16:07:48 +0800	[thread overview]
Message-ID: <4F66E954.8010409@redhat.com> (raw)
In-Reply-To: <465d054c01aef04f1adb43e0aaee4023a76c2bc3.1332143157.git.zliu@redhat.com>

On 03/19/2012 04:03 PM, Zhouping Liu wrote:
> Since commit http://git.kernel.org/linus/a42c390cfa0c,
> which added an option to control memcg swap, when kernel
> neither set CGROUP_MEM_RES_CTLR_SWAP_ENABLED nor add
> 'swapcount=1' kernel parameter, that indicates memcg swap
sorry, it has a typo, it should be 'swapaccount=1'
I'll resend a new patch.
> accounting is disabled, it will have no such file:
> memory.memsw.*, then oom03&  oom04 cases will fail.
>
> The patch fixed it, removed memsw cases when memcg swap
> accounting is disabled, and add a TINFO:
> tst_resm(TINFO,"memcg swap accounting disabled");
>
> Signed-off-by: Zhouping Liu<zliu@redhat.com>
> ---
>   testcases/kernel/mem/oom/oom03.c |   14 ++++++++++++--
>   testcases/kernel/mem/oom/oom04.c |   32 ++++++++++++++++++++++----------
>   2 files changed, 34 insertions(+), 12 deletions(-)
>
> diff --git a/testcases/kernel/mem/oom/oom03.c b/testcases/kernel/mem/oom/oom03.c
> index b90d4d7..d5e598b 100644
> --- a/testcases/kernel/mem/oom/oom03.c
> +++ b/testcases/kernel/mem/oom/oom03.c
> @@ -66,8 +66,18 @@ int main(int argc, char *argv[])
>   		write_file(MEMCG_PATH_NEW "/memory.limit_in_bytes", mem);
>   		testoom(0, 0, 0);
>
> -		write_file(MEMCG_PATH_NEW "/memory.memsw.limit_in_bytes", mem);
> -		testoom(0, 1, 0);
> +		if (access(MEMCG_PATH_NEW "/memory.memsw.limit_in_bytes",
> +		    F_OK) == -1) {
> +			if (errno == ENOENT)
> +				tst_resm(TINFO,
> +				    "memcg swap accounting disabled");
> +			else
> +				tst_brkm(TBROK|TERRNO, NULL, "access");
> +		} else {
> +			write_file(MEMCG_PATH_NEW
> +			     "/memory.memsw.limit_in_bytes", mem);
> +			testoom(0, 1, 0);
> +		}
>   	}
>   	cleanup();
>   	tst_exit();
> diff --git a/testcases/kernel/mem/oom/oom04.c b/testcases/kernel/mem/oom/oom04.c
> index fb35f96..2bbf4f1 100644
> --- a/testcases/kernel/mem/oom/oom04.c
> +++ b/testcases/kernel/mem/oom/oom04.c
> @@ -76,16 +76,28 @@ int main(int argc, char *argv[])
>   		tst_resm(TINFO, "process mempolicy.");
>   		testoom(1, 0, 1);
>
> -		write_file(MEMCG_PATH_NEW "/memory.memsw.limit_in_bytes", mem);
> -		testoom(1, 1, 1);
> -
> -		tst_resm(TINFO, "process cpuset.");
> -
> -		write_file(MEMCG_PATH_NEW "/memory.memsw.limit_in_bytes", "-1");
> -		testoom(0, 0, 1);
> -
> -		write_file(MEMCG_PATH_NEW "/memory.memsw.limit_in_bytes", mem);
> -		testoom(0, 1, 1);
> +		if (access(MEMCG_PATH_NEW "/memory.memsw.limit_in_bytes",
> +		    F_OK) == -1) {
> +			if (errno == ENOENT)
> +				tst_resm(TINFO,
> +				    "memcg swap accounting disabled");
> +			else
> +				tst_brkm(TBROK|TERRNO, NULL, "access");
> +		} else {
> +			write_file(MEMCG_PATH_NEW
> +			    "/memory.memsw.limit_in_bytes", mem);
> +			testoom(1, 1, 1);
> +
> +			tst_resm(TINFO, "process cpuset.");
> +
> +			write_file(MEMCG_PATH_NEW
> +			    "/memory.memsw.limit_in_bytes", "-1");
> +			testoom(0, 0, 1);
> +
> +			write_file(MEMCG_PATH_NEW
> +			    "/memory.memsw.limit_in_bytes", mem);
> +			testoom(0, 1, 1);
> +		}
>   	}
>   	cleanup();
>   	tst_exit();


------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

  reply	other threads:[~2012-03-19  8:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-19  8:17 [LTP] [PATCH v2] mem/oom: avoid unexpected error when no memcg swap accounting Zhouping Liu
2012-03-19  8:07 ` ZhoupingLiu [this message]
2012-03-19  8:18 ` [LTP] [PATCH] " Wanlong Gao
2012-03-19 10:29   ` ZhoupingLiu

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=4F66E954.8010409@redhat.com \
    --to=zliu@redhat.com \
    --cc=caiqian@redhat.com \
    --cc=czhang@redhat.com \
    --cc=ltp-list@lists.sourceforge.net \
    /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 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.