THe shmoverride tests also fail with overcommit pages allocated, this
patch saves their value and then restores it when the test is finished.

Signed-off-by: Eric B Munson <[EMAIL PROTECTED]>
---
 tests/shmoverride_unlinked.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/tests/shmoverride_unlinked.c b/tests/shmoverride_unlinked.c
index 5813cb7..a018300 100644
--- a/tests/shmoverride_unlinked.c
+++ b/tests/shmoverride_unlinked.c
@@ -45,6 +45,7 @@ extern int errno;
 #define DYNAMIC_SYSCTL "/proc/sys/vm/nr_overcommit_hugepages"
 static long saved_nr_hugepages = -1;
 static long hpage_size, bpage_size;
+static long saved_nr_overcommit = -1;
 
 /* Required pool size for test */
 #define POOL_SIZE 4
@@ -196,6 +197,9 @@ void cleanup(void)
        /* Restore the pool size. */
        if (saved_nr_hugepages >= 0)
                setup_hugetlb_pool(saved_nr_hugepages);
+
+       if (saved_nr_overcommit >= 0)
+               restore_overcommit_pages(hpage_size, saved_nr_overcommit);
 }
 
 int main(int argc, char **argv)
@@ -212,6 +216,8 @@ int main(int argc, char **argv)
         */
        hpage_size = local_read_meminfo("Hugepagesize:") * 1024;
        bpage_size = getpagesize();
+       saved_nr_overcommit = save_overcommit_pages(hpage_size);
+       set_nr_overcommit_hugepages(hpage_size, 0);
 
        /* Run the test with small pages */
        setenv("HUGETLB_SHM", "no", 1);
-- 
1.6.0.3


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Libhugetlbfs-devel mailing list
Libhugetlbfs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libhugetlbfs-devel

Reply via email to