public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* Re: [LTP] [PATCH] mem/oom: avoid unexpected error when no memcg swap accounting
  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
  2012-03-19  8:18 ` Wanlong Gao
  1 sibling, 0 replies; 4+ messages in thread
From: ZhoupingLiu @ 2012-03-19  8:07 UTC (permalink / raw)
  To: Caspar Zhang; +Cc: LTP List, Cai Qian

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

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

* [LTP] [PATCH v2] mem/oom: avoid unexpected error when no memcg swap accounting
@ 2012-03-19  8:17 Zhouping Liu
  2012-03-19  8:07 ` [LTP] [PATCH] " ZhoupingLiu
  2012-03-19  8:18 ` Wanlong Gao
  0 siblings, 2 replies; 4+ messages in thread
From: Zhouping Liu @ 2012-03-19  8:17 UTC (permalink / raw)
  To: Caspar Zhang; +Cc: LTP List, Cai Qian

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
'swapaccount=1' kernel parameter, that indicates memcg swap
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 added 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();
-- 
1.7.7.6


------------------------------------------------------------------------------
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

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

* Re: [LTP] [PATCH] mem/oom: avoid unexpected error when no memcg swap accounting
  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 ` [LTP] [PATCH] " ZhoupingLiu
@ 2012-03-19  8:18 ` Wanlong Gao
  2012-03-19 10:29   ` ZhoupingLiu
  1 sibling, 1 reply; 4+ messages in thread
From: Wanlong Gao @ 2012-03-19  8:18 UTC (permalink / raw)
  To: Zhouping Liu; +Cc: Cai Qian, LTP List

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
> 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>


Looks good to me except the typo. thanks Zhouping.

Reviewed-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>

Regards,
Wanlong Gao

> ---
>  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

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

* Re: [LTP] [PATCH] mem/oom: avoid unexpected error when no memcg swap accounting
  2012-03-19  8:18 ` Wanlong Gao
@ 2012-03-19 10:29   ` ZhoupingLiu
  0 siblings, 0 replies; 4+ messages in thread
From: ZhoupingLiu @ 2012-03-19 10:29 UTC (permalink / raw)
  To: gaowanlong; +Cc: Cai Qian, LTP List

On 03/19/2012 04:18 PM, Wanlong Gao wrote:
> 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
>> 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>
>
> Looks good to me except the typo. thanks Zhouping.

Wanlong, Thanks for your reviewing.
I have sent a v3, please review it again.

thanks,
Zhouping

>
> Reviewed-by: Wanlong Gao<gaowanlong@cn.fujitsu.com>
>
> Regards,
> Wanlong Gao
>
>> ---
>>   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

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

end of thread, other threads:[~2012-03-19 10:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [LTP] [PATCH] " ZhoupingLiu
2012-03-19  8:18 ` Wanlong Gao
2012-03-19 10:29   ` ZhoupingLiu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox