* [LTP] [PATCH] controllers/memcg: Mark testcase_2 as pass when mlock failed
@ 2016-06-01 3:00 Dong ZHu
2016-06-01 9:07 ` [LTP] [Re-Send][PATCH] " Dong ZHu
0 siblings, 1 reply; 8+ messages in thread
From: Dong ZHu @ 2016-06-01 3:00 UTC (permalink / raw)
To: ltp
While running "memcg_memsw_limit_in_bytes_test" always reported below error:
"memcg_memsw_limit_in_bytes_test 2 TFAIL : ltpapicmd.c:193: process 3769
is killed by error"
In function mmap_lock2() mlock failed to lock pages with errno EAGAIN,
the "memcg_process" process exit not the oom killer kill it.
Base on the this:
http://marc.info/?l=linux-mm&m=142122902313315&w=2
So mlock failed it is a expect behavior, in this case test should return
PASS.
Signed-off-by: Dong Zhu <bluezhudong@gmail.com>
---
testcases/kernel/controllers/memcg/functional/memcg_lib.sh | 3 +++
testcases/kernel/controllers/memcg/functional/memcg_process.c | 8 ++++++--
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/testcases/kernel/controllers/memcg/functional/memcg_lib.sh
b/testcases/kernel/controllers/memcg/functional/memcg_lib.sh
index 9b9b0fd..2f889ab 100755
--- a/testcases/kernel/controllers/memcg/functional/memcg_lib.sh
+++ b/testcases/kernel/controllers/memcg/functional/memcg_lib.sh
@@ -229,8 +229,11 @@ test_proc_kill()
ps -p $pid > /dev/null 2> /dev/null
if [ $? -ne 0 ]; then
wait $pid
+ ret=$?
if [ $? -eq 1 ]; then
result $FAIL "process $pid is killed by error"
+ elif [[ $2 == "--mmap-lock2" ]] && [[ $ret -eq 0 ]]; then
+ result $PASS "process $pid exit, mlock failed to lock
page return with errno EAGAIN"
else
result $PASS "process $pid is killed"
fi
diff --git a/testcases/kernel/controllers/memcg/functional/memcg_process.c
b/testcases/kernel/controllers/memcg/functional/memcg_process.c
index 3d34394..dc33567 100644
--- a/testcases/kernel/controllers/memcg/functional/memcg_process.c
+++ b/testcases/kernel/controllers/memcg/functional/memcg_process.c
@@ -203,8 +203,12 @@ void mmap_lock2()
if (p == MAP_FAILED)
err(1, "mmap failed");
- if (mlock(p, memsize) == -1)
- err(1, "mlock failed");
+ if (mlock(p, memsize) == -1) {
+ if (errno == EAGAIN)
+ flag_exit = 1;
+ else
+ err(1, "mlock failed");
+ }
} else {
if (munmap(p, memsize) == -1)
err(1, "munmap failed");
--
2.1.0
--
Best Regards,
Dong Zhu
My Site: http://bluezd.info
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [LTP] [Re-Send][PATCH] controllers/memcg: Mark testcase_2 as pass when mlock failed
2016-06-01 3:00 [LTP] [PATCH] controllers/memcg: Mark testcase_2 as pass when mlock failed Dong ZHu
@ 2016-06-01 9:07 ` Dong ZHu
2016-06-01 9:36 ` Cyril Hrubis
0 siblings, 1 reply; 8+ messages in thread
From: Dong ZHu @ 2016-06-01 9:07 UTC (permalink / raw)
To: ltp
There was a format issue in former mail, re-send this patch as below:
--8<--
While running "memcg_memsw_limit_in_bytes_test" always reported below error:
"memcg_memsw_limit_in_bytes_test 2 TFAIL : ltpapicmd.c:193: process 3769
is killed by error"
In function mmap_lock2() mlock failed to lock pages with errno EAGAIN,
the "memcg_process" process exit not the oom killer kill it.
Base on the this:
http://marc.info/?l=linux-mm&m=142122902313315&w=2
So mlock failed it is a expect behavior, in this case test should return
PASS.
Signed-off-by: Dong Zhu <bluezhudong@gmail.com>
---
testcases/kernel/controllers/memcg/functional/memcg_lib.sh | 3 +++
testcases/kernel/controllers/memcg/functional/memcg_process.c | 8 ++++++--
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/testcases/kernel/controllers/memcg/functional/memcg_lib.sh b/testcases/kernel/controllers/memcg/functional/memcg_lib.sh
index 9b9b0fd..2f889ab 100755
--- a/testcases/kernel/controllers/memcg/functional/memcg_lib.sh
+++ b/testcases/kernel/controllers/memcg/functional/memcg_lib.sh
@@ -229,8 +229,11 @@ test_proc_kill()
ps -p $pid > /dev/null 2> /dev/null
if [ $? -ne 0 ]; then
wait $pid
+ ret=$?
if [ $? -eq 1 ]; then
result $FAIL "process $pid is killed by error"
+ elif [[ $2 == "--mmap-lock2" ]] && [[ $ret -eq 0 ]]; then
+ result $PASS "process $pid exit, mlock failed to lock page return with errno EAGAIN"
else
result $PASS "process $pid is killed"
fi
diff --git a/testcases/kernel/controllers/memcg/functional/memcg_process.c b/testcases/kernel/controllers/memcg/functional/memcg_process.c
index 3d34394..dc33567 100644
--- a/testcases/kernel/controllers/memcg/functional/memcg_process.c
+++ b/testcases/kernel/controllers/memcg/functional/memcg_process.c
@@ -203,8 +203,12 @@ void mmap_lock2()
if (p == MAP_FAILED)
err(1, "mmap failed");
- if (mlock(p, memsize) == -1)
- err(1, "mlock failed");
+ if (mlock(p, memsize) == -1) {
+ if (errno == EAGAIN)
+ flag_exit = 1;
+ else
+ err(1, "mlock failed");
+ }
} else {
if (munmap(p, memsize) == -1)
err(1, "munmap failed");
--
2.1.0
--
Best Regards,
Dong Zhu
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [LTP] [Re-Send][PATCH] controllers/memcg: Mark testcase_2 as pass when mlock failed
2016-06-01 9:07 ` [LTP] [Re-Send][PATCH] " Dong ZHu
@ 2016-06-01 9:36 ` Cyril Hrubis
2016-06-02 1:36 ` [LTP] [PATCH V2] " Dong ZHu
0 siblings, 1 reply; 8+ messages in thread
From: Cyril Hrubis @ 2016-06-01 9:36 UTC (permalink / raw)
To: ltp
Hi!
> There was a format issue in former mail, re-send this patch as below:
This one is much better but not yet 100% right. Comments below.
> While running "memcg_memsw_limit_in_bytes_test" always reported below error:
> "memcg_memsw_limit_in_bytes_test 2 TFAIL : ltpapicmd.c:193: process 3769
> is killed by error"
>
> In function mmap_lock2() mlock failed to lock pages with errno EAGAIN,
> the "memcg_process" process exit not the oom killer kill it.
>
> Base on the this:
> http://marc.info/?l=linux-mm&m=142122902313315&w=2
>
> So mlock failed it is a expect behavior, in this case test should return
> PASS.
>
> Signed-off-by: Dong Zhu <bluezhudong@gmail.com>
> ---
> testcases/kernel/controllers/memcg/functional/memcg_lib.sh | 3 +++
> testcases/kernel/controllers/memcg/functional/memcg_process.c | 8 ++++++--
> 2 files changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/testcases/kernel/controllers/memcg/functional/memcg_lib.sh b/testcases/kernel/controllers/memcg/functional/memcg_lib.sh
> index 9b9b0fd..2f889ab 100755
> --- a/testcases/kernel/controllers/memcg/functional/memcg_lib.sh
> +++ b/testcases/kernel/controllers/memcg/functional/memcg_lib.sh
> @@ -229,8 +229,11 @@ test_proc_kill()
> ps -p $pid > /dev/null 2> /dev/null
> if [ $? -ne 0 ]; then
> wait $pid
> + ret=$?
> if [ $? -eq 1 ]; then
> result $FAIL "process $pid is killed by error"
> + elif [[ $2 == "--mmap-lock2" ]] && [[ $ret -eq 0 ]]; then
> + result $PASS "process $pid exit, mlock failed to lock page return with errno EAGAIN"
> else
> result $PASS "process $pid is killed"
> fi
> diff --git a/testcases/kernel/controllers/memcg/functional/memcg_process.c b/testcases/kernel/controllers/memcg/functional/memcg_process.c
> index 3d34394..dc33567 100644
> --- a/testcases/kernel/controllers/memcg/functional/memcg_process.c
> +++ b/testcases/kernel/controllers/memcg/functional/memcg_process.c
> @@ -203,8 +203,12 @@ void mmap_lock2()
> if (p == MAP_FAILED)
> err(1, "mmap failed");
>
> - if (mlock(p, memsize) == -1)
> - err(1, "mlock failed");
> + if (mlock(p, memsize) == -1) {
> + if (errno == EAGAIN)
> + flag_exit = 1;
> + else
> + err(1, "mlock failed");
> + }
Please use tabs only for the indentation. This code mixes tabs and
spaces.
Also I think that it would be far better if we do just exit(2) here and
print somehing as "Failed to allocate/lock/populate memory" from
memcg_lib.sh if the memcg_process.c exits with 2 in the test_proc_kill().
> } else {
> if (munmap(p, memsize) == -1)
> err(1, "munmap failed");
> --
> 2.1.0
>
> --
> Best Regards,
> Dong Zhu
--
Cyril Hrubis
chrubis@suse.cz
^ permalink raw reply [flat|nested] 8+ messages in thread
* [LTP] [PATCH V2] controllers/memcg: Mark testcase_2 as pass when mlock failed
2016-06-01 9:36 ` Cyril Hrubis
@ 2016-06-02 1:36 ` Dong ZHu
2016-06-06 1:20 ` Dong ZHu
2016-06-06 13:16 ` Cyril Hrubis
0 siblings, 2 replies; 8+ messages in thread
From: Dong ZHu @ 2016-06-02 1:36 UTC (permalink / raw)
To: ltp
On Wed, Jun 01, 2016 at 11:36:52AM +0200, Cyril Hrubis wrote:
> Hi!
> This one is much better but not yet 100% right. Comments below.
Thanks for your suggestion.
> Please use tabs only for the indentation. This code mixes tabs and
> spaces.
Fixed it.
>
> Also I think that it would be far better if we do just exit(2) here and
> print somehing as "Failed to allocate/lock/populate memory" from
> memcg_lib.sh if the memcg_process.c exits with 2 in the test_proc_kill().
I think we should make a judgment of the return value of mlock, because
only EAGAIN is expected.
Below is the patch:
--8<--
While running "memcg_memsw_limit_in_bytes_test" always reported below error:
"memcg_memsw_limit_in_bytes_test 2 TFAIL : ltpapicmd.c:193: process 3769
is killed by error"
In function mmap_lock2() mlock failed to lock pages with errno EAGAIN,
the "memcg_process" process exit not the oom killer kill it.
Base on the this:
http://marc.info/?l=linux-mm&m=142122902313315&w=2
So mlock failed it is a expect behavior, in this case test should return
PASS.
Signed-off-by: Dong Zhu <bluezhudong@gmail.com>
---
testcases/kernel/controllers/memcg/functional/memcg_lib.sh | 5 ++++-
testcases/kernel/controllers/memcg/functional/memcg_process.c | 8 ++++++--
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/testcases/kernel/controllers/memcg/functional/memcg_lib.sh b/testcases/kernel/controllers/memcg/functional/memcg_lib.sh
index 9b9b0fd..b0dfce0 100755
--- a/testcases/kernel/controllers/memcg/functional/memcg_lib.sh
+++ b/testcases/kernel/controllers/memcg/functional/memcg_lib.sh
@@ -229,8 +229,11 @@ test_proc_kill()
ps -p $pid > /dev/null 2> /dev/null
if [ $? -ne 0 ]; then
wait $pid
- if [ $? -eq 1 ]; then
+ ret=$?
+ if [ $ret -eq 1 ]; then
result $FAIL "process $pid is killed by error"
+ elif [[ $ret -eq 2 ]]; then
+ result $PASS "Failed to lock memory"
else
result $PASS "process $pid is killed"
fi
diff --git a/testcases/kernel/controllers/memcg/functional/memcg_process.c b/testcases/kernel/controllers/memcg/functional/memcg_process.c
index 3d34394..40c677b 100644
--- a/testcases/kernel/controllers/memcg/functional/memcg_process.c
+++ b/testcases/kernel/controllers/memcg/functional/memcg_process.c
@@ -203,8 +203,12 @@ void mmap_lock2()
if (p == MAP_FAILED)
err(1, "mmap failed");
- if (mlock(p, memsize) == -1)
- err(1, "mlock failed");
+ if (mlock(p, memsize) == -1) {
+ if (errno == EAGAIN)
+ exit(2);
+ else
+ err(1, "mlock failed");
+ }
} else {
if (munmap(p, memsize) == -1)
err(1, "munmap failed");
--
2.1.0
--
Best Regards,
Dong Zhu
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [LTP] [PATCH V2] controllers/memcg: Mark testcase_2 as pass when mlock failed
2016-06-02 1:36 ` [LTP] [PATCH V2] " Dong ZHu
@ 2016-06-06 1:20 ` Dong ZHu
2016-06-06 13:16 ` Cyril Hrubis
1 sibling, 0 replies; 8+ messages in thread
From: Dong ZHu @ 2016-06-06 1:20 UTC (permalink / raw)
To: ltp
Hi Cyril Hrubis,
How about this version of patch ? whether it could be appceted ?
On Thu, Jun 02, 2016 at 09:36:57AM +0800, Dong ZHu wrote:
> On Wed, Jun 01, 2016 at 11:36:52AM +0200, Cyril Hrubis wrote:
> > Hi!
> > This one is much better but not yet 100% right. Comments below.
>
> Thanks for your suggestion.
>
> > Please use tabs only for the indentation. This code mixes tabs and
> > spaces.
>
> Fixed it.
>
> >
> > Also I think that it would be far better if we do just exit(2) here and
> > print somehing as "Failed to allocate/lock/populate memory" from
> > memcg_lib.sh if the memcg_process.c exits with 2 in the test_proc_kill().
>
> I think we should make a judgment of the return value of mlock, because
> only EAGAIN is expected.
>
> Below is the patch:
>
> --8<--
>
> While running "memcg_memsw_limit_in_bytes_test" always reported below error:
> "memcg_memsw_limit_in_bytes_test 2 TFAIL : ltpapicmd.c:193: process 3769
> is killed by error"
>
> In function mmap_lock2() mlock failed to lock pages with errno EAGAIN,
> the "memcg_process" process exit not the oom killer kill it.
>
> Base on the this:
> http://marc.info/?l=linux-mm&m=142122902313315&w=2
>
> So mlock failed it is a expect behavior, in this case test should return
> PASS.
>
> Signed-off-by: Dong Zhu <bluezhudong@gmail.com>
> ---
> testcases/kernel/controllers/memcg/functional/memcg_lib.sh | 5 ++++-
> testcases/kernel/controllers/memcg/functional/memcg_process.c | 8 ++++++--
> 2 files changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/testcases/kernel/controllers/memcg/functional/memcg_lib.sh b/testcases/kernel/controllers/memcg/functional/memcg_lib.sh
> index 9b9b0fd..b0dfce0 100755
> --- a/testcases/kernel/controllers/memcg/functional/memcg_lib.sh
> +++ b/testcases/kernel/controllers/memcg/functional/memcg_lib.sh
> @@ -229,8 +229,11 @@ test_proc_kill()
> ps -p $pid > /dev/null 2> /dev/null
> if [ $? -ne 0 ]; then
> wait $pid
> - if [ $? -eq 1 ]; then
> + ret=$?
> + if [ $ret -eq 1 ]; then
> result $FAIL "process $pid is killed by error"
> + elif [[ $ret -eq 2 ]]; then
> + result $PASS "Failed to lock memory"
> else
> result $PASS "process $pid is killed"
> fi
> diff --git a/testcases/kernel/controllers/memcg/functional/memcg_process.c b/testcases/kernel/controllers/memcg/functional/memcg_process.c
> index 3d34394..40c677b 100644
> --- a/testcases/kernel/controllers/memcg/functional/memcg_process.c
> +++ b/testcases/kernel/controllers/memcg/functional/memcg_process.c
> @@ -203,8 +203,12 @@ void mmap_lock2()
> if (p == MAP_FAILED)
> err(1, "mmap failed");
>
> - if (mlock(p, memsize) == -1)
> - err(1, "mlock failed");
> + if (mlock(p, memsize) == -1) {
> + if (errno == EAGAIN)
> + exit(2);
> + else
> + err(1, "mlock failed");
> + }
> } else {
> if (munmap(p, memsize) == -1)
> err(1, "munmap failed");
> --
> 2.1.0
>
> --
> Best Regards,
> Dong Zhu
--
Best Regards,
Dong Zhu
^ permalink raw reply [flat|nested] 8+ messages in thread
* [LTP] [PATCH V2] controllers/memcg: Mark testcase_2 as pass when mlock failed
2016-06-02 1:36 ` [LTP] [PATCH V2] " Dong ZHu
2016-06-06 1:20 ` Dong ZHu
@ 2016-06-06 13:16 ` Cyril Hrubis
2016-06-07 1:44 ` [LTP] [PATCH V3] " Dong ZHu
1 sibling, 1 reply; 8+ messages in thread
From: Cyril Hrubis @ 2016-06-06 13:16 UTC (permalink / raw)
To: ltp
Hi!
> @@ -229,8 +229,11 @@ test_proc_kill()
> ps -p $pid > /dev/null 2> /dev/null
> if [ $? -ne 0 ]; then
> wait $pid
> - if [ $? -eq 1 ]; then
> + ret=$?
> + if [ $ret -eq 1 ]; then
> result $FAIL "process $pid is killed by error"
> + elif [[ $ret -eq 2 ]]; then
> + result $PASS "Failed to lock memory"
The [[ is bashism (and will not work on Debian), use single brackets
instead.
> else
> result $PASS "process $pid is killed"
> fi
> diff --git a/testcases/kernel/controllers/memcg/functional/memcg_process.c b/testcases/kernel/controllers/memcg/functional/memcg_process.c
> index 3d34394..40c677b 100644
> --- a/testcases/kernel/controllers/memcg/functional/memcg_process.c
> +++ b/testcases/kernel/controllers/memcg/functional/memcg_process.c
> @@ -203,8 +203,12 @@ void mmap_lock2()
> if (p == MAP_FAILED)
> err(1, "mmap failed");
>
> - if (mlock(p, memsize) == -1)
> - err(1, "mlock failed");
> + if (mlock(p, memsize) == -1) {
> + if (errno == EAGAIN)
> + exit(2);
> + else
> + err(1, "mlock failed");
> + }
The code indented by spaces again. Plase use tabs only.
> } else {
> if (munmap(p, memsize) == -1)
> err(1, "munmap failed");
--
Cyril Hrubis
chrubis@suse.cz
^ permalink raw reply [flat|nested] 8+ messages in thread
* [LTP] [PATCH V3] controllers/memcg: Mark testcase_2 as pass when mlock failed
2016-06-06 13:16 ` Cyril Hrubis
@ 2016-06-07 1:44 ` Dong ZHu
2016-06-07 10:45 ` Cyril Hrubis
0 siblings, 1 reply; 8+ messages in thread
From: Dong ZHu @ 2016-06-07 1:44 UTC (permalink / raw)
To: ltp
Hi,
I refined the patch followed by your suggestion, below is the latest
version:
---8<---
While running "memcg_memsw_limit_in_bytes_test" always reported below error:
"memcg_memsw_limit_in_bytes_test 2 TFAIL : ltpapicmd.c:193: process 3769
is killed by error"
In function mmap_lock2() mlock failed to lock pages with errno EAGAIN,
the "memcg_process" process exit not the oom killer kill it.
And base on this:
http://marc.info/?l=linux-mm&m=142122902313315&w=2
So mlock failed it is a expect behavior, in this case test should return
PASS.
Signed-off-by: Dong Zhu <bluezhudong@gmail.com>
---
testcases/kernel/controllers/memcg/functional/memcg_lib.sh | 5 ++++-
testcases/kernel/controllers/memcg/functional/memcg_process.c | 8 ++++++--
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/testcases/kernel/controllers/memcg/functional/memcg_lib.sh b/testcases/kernel/controllers/memcg/functional/memcg_lib.sh
index 9b9b0fd..c90d0a2 100755
--- a/testcases/kernel/controllers/memcg/functional/memcg_lib.sh
+++ b/testcases/kernel/controllers/memcg/functional/memcg_lib.sh
@@ -229,8 +229,11 @@ test_proc_kill()
ps -p $pid > /dev/null 2> /dev/null
if [ $? -ne 0 ]; then
wait $pid
- if [ $? -eq 1 ]; then
+ ret=$?
+ if [ $ret -eq 1 ]; then
result $FAIL "process $pid is killed by error"
+ elif [ $ret -eq 2 ]; then
+ result $PASS "Failed to lock memory"
else
result $PASS "process $pid is killed"
fi
diff --git a/testcases/kernel/controllers/memcg/functional/memcg_process.c b/testcases/kernel/controllers/memcg/functional/memcg_process.c
index 3d34394..c12fae1 100644
--- a/testcases/kernel/controllers/memcg/functional/memcg_process.c
+++ b/testcases/kernel/controllers/memcg/functional/memcg_process.c
@@ -203,8 +203,12 @@ void mmap_lock2()
if (p == MAP_FAILED)
err(1, "mmap failed");
- if (mlock(p, memsize) == -1)
- err(1, "mlock failed");
+ if (mlock(p, memsize) == -1) {
+ if (errno == EAGAIN)
+ exit(2);
+ else
+ err(1, "mlock failed");
+ }
} else {
if (munmap(p, memsize) == -1)
err(1, "munmap failed");
--
2.1.0
--
Best Regards,
Dong Zhu
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [LTP] [PATCH V3] controllers/memcg: Mark testcase_2 as pass when mlock failed
2016-06-07 1:44 ` [LTP] [PATCH V3] " Dong ZHu
@ 2016-06-07 10:45 ` Cyril Hrubis
0 siblings, 0 replies; 8+ messages in thread
From: Cyril Hrubis @ 2016-06-07 10:45 UTC (permalink / raw)
To: ltp
Hi!
> I refined the patch followed by your suggestion, below is the latest
> version:
Pushed with a slightly modified commit message, thanks.
--
Cyril Hrubis
chrubis@suse.cz
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2016-06-07 10:45 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-01 3:00 [LTP] [PATCH] controllers/memcg: Mark testcase_2 as pass when mlock failed Dong ZHu
2016-06-01 9:07 ` [LTP] [Re-Send][PATCH] " Dong ZHu
2016-06-01 9:36 ` Cyril Hrubis
2016-06-02 1:36 ` [LTP] [PATCH V2] " Dong ZHu
2016-06-06 1:20 ` Dong ZHu
2016-06-06 13:16 ` Cyril Hrubis
2016-06-07 1:44 ` [LTP] [PATCH V3] " Dong ZHu
2016-06-07 10:45 ` 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.