From: madhura <madhura@linux.vnet.ibm.com>
To: ltp-list@lists.sourceforge.net
Subject: [LTP] [PATCH] max_map_count: Fails due to negative memfree value
Date: Thu, 17 Jan 2013 17:18:49 +0530 [thread overview]
Message-ID: <50F7E521.5050204@linux.vnet.ibm.com> (raw)
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
next reply other threads:[~2013-01-17 11:49 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-17 11:48 madhura [this message]
2013-01-17 13:34 ` [LTP] [PATCH] max_map_count: Fails due to negative memfree value Zhouping Liu
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=50F7E521.5050204@linux.vnet.ibm.com \
--to=madhura@linux.vnet.ibm.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