From: Caspar Zhang <caspar@casparzhang.com>
To: ltp-list@lists.sourceforge.net
Subject: Re: [LTP] [PATCH] memcg_function:fix the wrong use of mlock
Date: Thu, 15 Dec 2011 11:05:20 +0800 [thread overview]
Message-ID: <4EE963F0.9090201@casparzhang.com> (raw)
In-Reply-To: <4EE95F75.6030909@cn.fujitsu.com>
On 12/15/2011 10:46 AM, Peng Haitao wrote:
>
> mlock and munmap will return -1 when ERROR.
>
> Signed-off-by: Peng Haitao <penght@cn.fujitsu.com>
Nice catch.
Reviewed-by: Caspar Zhang <caspar@casparzhang.com>
> ---
> .../cpuset/cpuset_memory_test/cpuset_memory_test.c | 4 ++--
> .../controllers/memcg/functional/memcg_process.c | 6 +++---
> 2 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/testcases/kernel/controllers/cpuset/cpuset_memory_test/cpuset_memory_test.c b/testcases/kernel/controllers/cpuset/cpuset_memory_test/cpuset_memory_test.c
> index 8d37b24..512df3a 100644
> --- a/testcases/kernel/controllers/cpuset/cpuset_memory_test/cpuset_memory_test.c
> +++ b/testcases/kernel/controllers/cpuset/cpuset_memory_test/cpuset_memory_test.c
> @@ -196,7 +196,7 @@ void mmap_file(int flag_allocated)
> }
> touch_memory_and_echo_node(p, memsize);
> } else {
> - if (!munmap(p, memsize) == -1)
> + if (munmap(p, memsize) == -1)
> err(1, "munmap(file) failed");
>
> if (opt_hugepage) {
> @@ -236,7 +236,7 @@ void mmap_lock2(int flag_allocated)
> err(1, "mlock failed");
> touch_memory_and_echo_node(p, memsize);
> } else {
> - if (!munmap(p, memsize) == -1)
> + if (munmap(p, memsize) == -1)
> err(1, "munmap failed");
> }
> }
> diff --git a/testcases/kernel/controllers/memcg/functional/memcg_process.c b/testcases/kernel/controllers/memcg/functional/memcg_process.c
> index 4f8c257..37ded19 100644
> --- a/testcases/kernel/controllers/memcg/functional/memcg_process.c
> +++ b/testcases/kernel/controllers/memcg/functional/memcg_process.c
> @@ -167,7 +167,7 @@ void mmap_file()
> }
> touch_memory(p, memsize);
> } else {
> - if (!munmap(p, memsize) == -1)
> + if (munmap(p, memsize) == -1)
> err(1, "munmap(file) failed");
>
> if (opt_hugepage) {
> @@ -202,10 +202,10 @@ void mmap_lock2()
> if (p == MAP_FAILED)
> err(1, "mmap failed");
>
> - if (!mlock(p, memsize))
> + if (mlock(p, memsize) == -1)
> err(1, "mlock failed");
> } else {
> - if (!munmap(p, memsize) == -1)
> + if (munmap(p, memsize) == -1)
> err(1, "munmap failed");
> }
> }
------------------------------------------------------------------------------
10 Tips for Better Server Consolidation
Server virtualization is being driven by many needs.
But none more important than the need to reduce IT complexity
while improving strategic productivity. Learn More!
http://www.accelacomm.com/jaw/sdnl/114/51507609/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
next parent reply other threads:[~2011-12-15 3:06 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <4EE95F75.6030909@cn.fujitsu.com>
2011-12-15 3:05 ` Caspar Zhang [this message]
[not found] ` <4EE963A9.7030100@cn.fujitsu.com>
2011-12-15 5:44 ` [LTP] [PATCH] memcg_function:fix the wrong use of mlock Garrett Cooper
2011-12-15 5:52 ` Wanlong Gao
[not found] ` <6d5f6f84-cdfa-42d0-a3a5-f9d028419818@zmail16.collab.prod.int.phx2.redhat.com>
2011-12-21 14:09 ` Cyril Hrubis
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=4EE963F0.9090201@casparzhang.com \
--to=caspar@casparzhang.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox