max_map_count: Fails due to negative memfree value
PATCH 1/1 max_map_count: Fails due to negative memfree value
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.
testcases/kernel/mem/tunable/max_map_count.c renamed from testcases/kernel/mem/tunable/max_map_count.c.org +3 -2
@@ -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 ;
Signature · 14 lines
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 [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
----- Original Message -----
Quoted 27 lines
From: "madhura" <[email protected]>
To: [email protected]
Sent: Thursday, January 17, 2013 7:48:49 PM
Subject: [LTP] [PATCH]max_map_count: Fails due to negative memfree valueIn 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 <[email protected]>---
ltp-full-20130109/testcases/kernel/mem/tunable/max_map_count.c.org2013-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 +0530testcases/kernel/mem/tunable/max_map_count.c renamed from testcases/kernel/mem/tunable/max_map_count.c.org +1
-1@@ -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;/*
testcases/kernel/mem/tunable/max_map_count.c static void max_map_count_test(void) · line 179
Quoted 7 lines
testcases/kernel/mem/tunable/max_map_count.c renamed from testcases/kernel/mem/tunable/max_map_count.c.org +2
-1@@ -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 ;
Generally, the situation (CommitLimit < Committed_AS) can't be hit,
IMO, if yes, that means your system has been some broken(I suppose it's kernel's issue)
so you should here add the below lines to catch the exception:
else {
tst_resm(TINFO, "CommmitLimit is %ld, Committed_AS"
" is %ld", commit_limit, committed);
tst_brkm(TBROK, cleanup, "Unexpected error: "
"CommitLimit < Committed_AS");
}Signature · 13 lines
Thanks, Zhouping ------------------------------------------------------------------------------ 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 [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list