public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP]  [PATCH] max_map_count: Fails due to negative memfree value
@ 2013-01-17 11:48 madhura
  2013-01-17 13:34 ` Zhouping Liu
  0 siblings, 1 reply; 2+ messages in thread
From: madhura @ 2013-01-17 11:48 UTC (permalink / raw)
  To: ltp-list

In situations when memory is occupied to a certain higher limit by system processes, the amount of memory available may be in negative/low values not suitable for testing.
Hence its better to have a memory check prior to the test beginning.

Signed-off-by: Madhura P S <madhura@linux.vnet.ibm.com>

--- ltp-full-20130109/testcases/kernel/mem/tunable/max_map_count.c.org	2013-01-17 17:15:38.957032558 +0530
+++ ltp-full-20130109/testcases/kernel/mem/tunable/max_map_count.c	2013-01-17 17:16:58.092909326 +0530
@@ -152,7 +152,7 @@ static void max_map_count_test(void)
  	pid_t pid;
  	long max_maps;
  	long map_count;
-	long max_iters;
+	long max_iters = 0;
  	long memfree;
  
  	/*
@@ -174,7 +174,8 @@ static void max_map_count_test(void)
  	 */
  	memfree = read_meminfo("CommitLimit:") - read_meminfo("Committed_AS:");
  	/* 64 used as a bias to make sure no overflow happen */
-	max_iters = memfree / sysconf(_SC_PAGESIZE) * 1024 - 64;
+	if (memfree > 0)
+		max_iters = memfree / sysconf(_SC_PAGESIZE) * 1024 - 64;
  	if (max_iters > MAX_MAP_COUNT)
  		max_iters = MAX_MAP_COUNT;




-- 
With Regards,
Madhura P S


------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122712
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

end of thread, other threads:[~2013-01-17 13:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-17 11:48 [LTP] [PATCH] max_map_count: Fails due to negative memfree value madhura
2013-01-17 13:34 ` Zhouping Liu

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