diff options
authorEric B Munson <ebmunson@us.ibm.com>2008-09-30 11:06:01 +0100
committerEric B Munson <ebmunson@us.ibm.com>2008-09-30 17:35:51 +0100
commit1f7f73596ab1aa3e1151766a9471ec68b5f7ba68 (patch)
parent7cd6ccd5e02d50adc51a9412141ae437d3fd80d6 (diff)
shmoverride test fix2.1-pre1
The shmoverride tests currently hang when run as a user. This is because the cleanup routine tries to reset the nr_hugepages value to what is was at the beginning of the test. This will fail with bad CONFIG which will try and call cleanup again. This patch initialises saved_nr_hugepages to -1 and does not restore the value in cleanup if it is <= 0. Signed-off-by: Eric B Munson <ebmunson@us.ibm.com> Acked-by: Adam Litke <agl@us.ibm.com>
1 files changed, 3 insertions, 2 deletions
diff --git a/tests/shmoverride_unlinked.c b/tests/shmoverride_unlinked.c
index 3f3ac3e..2721b92 100644
--- a/tests/shmoverride_unlinked.c
+++ b/tests/shmoverride_unlinked.c
@@ -42,7 +42,7 @@ extern int errno;
/* Global test configuration */
#define DYNAMIC_SYSCTL "/proc/sys/vm/nr_overcommit_hugepages"
-static long saved_nr_hugepages;
+static long saved_nr_hugepages = -1;
static long hpage_size, bpage_size;
/* Required pool size for test */
@@ -134,7 +134,8 @@ void run_test(char *desc, int hpages, int bpages, int pool_nr, int expect_diff)
void cleanup(void)
- set_nr_hugepages(saved_nr_hugepages);
+ if (saved_nr_hugepages >= 0)
+ set_nr_hugepages(saved_nr_hugepages);
int main(int argc, char **argv)