public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP]  [PATCH 1/3] tunable: reduce the min_free_kbytes tunable
@ 2012-08-29 12:42 Zhouping Liu
  2012-08-29 12:43 ` [LTP] [PATCH 2/3] tunable/min_free_kbytes: remove map_count args Zhouping Liu
  2012-08-29 12:43 ` [LTP] [PATCH 3/3] tunable/min_free_kbytes: add 32-bit system limit Zhouping Liu
  0 siblings, 2 replies; 8+ messages in thread
From: Zhouping Liu @ 2012-08-29 12:42 UTC (permalink / raw)
  To: LTP list

Setting min_free_kbytes too high will cause system hangs,
especially in i386 arch, using less than 5% of total memory
can avoid it, so choose %5 of free memory or 2% of total memory.
Thanks Shuang pointed out it.

also, in order to enlarge the coverage, the patch adds a new
case item: 2 * default tunable

Signed-off-by: Zhouping Liu <zliu@redhat.com>
Signed-off-by: Shuang Qiu <shuang.qiu@oracle.com>
---
 testcases/kernel/mem/tunable/min_free_kbytes.c | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/testcases/kernel/mem/tunable/min_free_kbytes.c b/testcases/kernel/mem/tunable/min_free_kbytes.c
index 00ead04..f8288ec 100644
--- a/testcases/kernel/mem/tunable/min_free_kbytes.c
+++ b/testcases/kernel/mem/tunable/min_free_kbytes.c
@@ -10,7 +10,8 @@
  * the current free memory with the tunable value repeatedly.
  *
  * a) default min_free_kbytes with all overcommit memory policy
- * b) half of mem_free with all overcommit memory policy
+ * b) 2x default value with all overcommit memory policy
+ * c) 5% of MemFree or %2 MemTotal with all overcommit memory policy
  *
  ********************************************************************
  * Copyright (C) 2012 Red Hat, Inc.
@@ -115,20 +116,27 @@ int main(int argc, char *argv[])
 static void test_tune(unsigned long overcommit_policy)
 {
 	int status;
-	int pid[2];
+	int pid[3];
 	int ret, i;
-	unsigned long tune, memfree;
+	unsigned long tune, memfree, memtotal;
 
 	set_sys_tune("overcommit_memory", overcommit_policy, 1);
 
-	for (i = 0; i < 2; i++) {
+	for (i = 0; i < 3; i++) {
 		/* case1 */
 		if (i == 0)
 			set_sys_tune("min_free_kbytes", default_tune, 1);
 		/* case2 */
-		else {
+		else if (i == 1) {
+			set_sys_tune("min_free_kbytes", 2 * default_tune, 1);
+		/* case3 */
+		} else {
 			memfree = read_meminfo("MemFree:");
-			tune = memfree / 2;
+			memtotal = read_meminfo("MemTotal:");
+			tune = memfree / 20;
+			if (tune > (memtotal / 50))
+				tune = memtotal / 50;
+
 			set_sys_tune("min_free_kbytes", tune, 1);
 		}
 
-- 
1.7.11.2


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

end of thread, other threads:[~2012-08-31  2:56 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-29 12:42 [LTP] [PATCH 1/3] tunable: reduce the min_free_kbytes tunable Zhouping Liu
2012-08-29 12:43 ` [LTP] [PATCH 2/3] tunable/min_free_kbytes: remove map_count args Zhouping Liu
2012-08-29 12:43 ` [LTP] [PATCH 3/3] tunable/min_free_kbytes: add 32-bit system limit Zhouping Liu
2012-08-31  2:07   ` Zhouping Liu
2012-08-31  2:11     ` Wanlong Gao
2012-08-31  2:17       ` Zhouping Liu
2012-08-31  2:44   ` Caspar Zhang
2012-08-31  2:54     ` Wanlong Gao

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