Skip to contentSkip to conversation

memcg_function:fix the wrong use of mlock

PATCH Caspar Zhang 4 participants 4 messages Dec 15, 2011 – Dec 21, 2011 3 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Caspar Zhang

author Reviewed-by
#1 lore raw
Quoted 4 lines · Peng Haitao

mlock and munmap will return -1 when ERROR.

Nice catch.

Quoted 43 lines
---
 .../cpuset/cpuset_memory_test/cpuset_memory_test.c |    4 ++--
 .../controllers/memcg/functional/memcg_process.c   |    6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)
testcases/kernel/controllers/cpuset/cpuset_memory_test/cpuset_memory_test.c +2 -2
index 8d37b24..512df3a 100644
@@ -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");
 	}
 }
testcases/kernel/controllers/memcg/functional/memcg_process.c +1 -1
index 4f8c257..37ded19 100644
@@ -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");

testcases/kernel/controllers/memcg/functional/memcg_process.c void mmap_lock2() · line 211

Quoted 10 lines
testcases/kernel/controllers/memcg/functional/memcg_process.c +2 -2
 
-		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 [email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

A message that is not in the archive (sent off-list or not yet received): [email protected]

#3 lore raw
Quoted 8 lines · Wanlong Gao
Quoted 4 lines · Peng Haitao

mlock and munmap will return -1 when ERROR.

Committed -- thanks!
-Garrett

------------------------------------------------------------------------------
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 [email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#4 lore raw

Hi Garrett:

What do you think about the patch set below now?

[PATCH 0/5] Automatically mount hugetlbfs for hugemmap tests.

Thanks a lot
-Wanlong Gao

Quoted 13 lines · Wanlong Gao
Quoted 8 lines · Peng Haitao
Quoted 5 lines

mlock and munmap will return -1 when ERROR.

Committed -- thanks!
-Garrett

------------------------------------------------------------------------------
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 [email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

A message that is not in the archive (sent off-list or not yet received): 6d5f6f84-cdfa-42d0-a3a5-f9d028419818@zmail16.collab.prod.int.phx2.redhat.com

#6 lore raw

Hi!

Quoted 9 lines

this should be commited already, but looking at git, I see changes only for memcg_process.c:

commit 17ecdc4e0f895f61067a65d6105f29d4f55680be

Author: Garrett Cooper <[email protected]>
Date:   Wed Dec 14 21:42:25 2011 -0800

mlock and munmap will return -1 if they fail.

Quoted 8 lines
 .../controllers/memcg/functional/memcg_process.c   |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

Have I missed some message on mailing list or did it slip by accident?

Looks like the second part is somehow missing.

Sigh, like when people are helping, but sometimes Garrett is actually making my life harder...

Signature · 13 lines
Cyril Hrubis
[email protected]

------------------------------------------------------------------------------
Write once. Port to many.
Get the SDK and tools to simplify cross-platform app development. Create 
new or port existing apps to sell to consumers worldwide. Explore the 
Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join
http://p.sf.net/sfu/intel-appdev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list