Skip to contentSkip to conversation

mem/hugeshmat04: check if system 'shmmax' large enough

PATCH In review Li Wang 2 participants 2 messages Jul 22, 2015 – Jul 29, 2015

lore
Share & tools
lore

Li Wang

author
#0 lore raw

PATCH v2 1/1 mem/hugeshmat04: check if system 'shmmax' large enough

V1 --> V2
Just try to setup 'SHMMAX' to a large size then do the test before we waive it.

---
 testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c +10 -2
index 7f0fbca..d6092d9 100644
@@ -59,6 +59,7 @@ static long huge_free;
 static long huge_free2;
 static long hugepages;
 static long orig_hugepages;
+static long orig_shmmax, new_shmmax;
 
 static void shared_hugepage(void);
 
@@ -128,8 +129,13 @@ void setup(void)
 	tst_require_root(NULL);
 
 	mem_total = read_meminfo("MemTotal:");
-	if (mem_total < 2L*1024*1024) {
-		tst_resm(TCONF, "Test requires more than 2GB of RAM");
+	SAFE_FILE_SCANF(NULL, PATH_SHMMAX, "%ld", &orig_shmmax);
+	SAFE_FILE_PRINTF(NULL, PATH_SHMMAX, "%ld", (long)SIZE);
+	SAFE_FILE_SCANF(NULL, PATH_SHMMAX, "%ld", &new_shmmax);
+
+	if (mem_total < 2L*1024*1024 || new_shmmax < SIZE) {
+		tst_resm(TCONF,
+			"Test requires more than 2GB of RAM or need a lager 'shmmax' value for testing");
 		tst_exit();
 	}
 
@@ -150,4 +156,6 @@ void setup(void)
 void cleanup(void)
 {
 	set_sys_tune("nr_hugepages", orig_hugepages, 0);
+	SAFE_FILE_PRINTF(NULL, PATH_SHMMAX, "%ld", orig_shmmax);
+
 }
Signature · 13 lines
1.8.3.1


------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
#1 lore raw

----- Original Message -----

Quoted 8 lines

From: "Li Wang" <[email protected]>
To: [email protected]
Sent: Wednesday, 22 July, 2015 12:02:07 PM
Subject: [LTP] [Patch v2] mem/hugeshmat04: check if system 'shmmax' large enough

V1 --> V2
Just try to setup 'SHMMAX' to a large size then do the test before we waive it.

Hi,

I have split the condition to two and made it print mem_total, new_shmmax in case it's lower. Also turned resm+exit to brkm(TCONF) and pushed.

Regards,
Jan

Quoted 47 lines
---
 testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c +10 -3
index 7f0fbca..d6092d9 100644
@@ -59,6 +59,7 @@ static long huge_free;
 static long huge_free2;
 static long hugepages;
 static long orig_hugepages;
+static long orig_shmmax, new_shmmax;
 
 static void shared_hugepage(void);
 
@@ -128,8 +129,13 @@ void setup(void)
 	tst_require_root(NULL);
 
 	mem_total = read_meminfo("MemTotal:");
-	if (mem_total < 2L*1024*1024) {
-		tst_resm(TCONF, "Test requires more than 2GB of RAM");
+	SAFE_FILE_SCANF(NULL, PATH_SHMMAX, "%ld", &orig_shmmax);
+	SAFE_FILE_PRINTF(NULL, PATH_SHMMAX, "%ld", (long)SIZE);
+	SAFE_FILE_SCANF(NULL, PATH_SHMMAX, "%ld", &new_shmmax);
+
+	if (mem_total < 2L*1024*1024 || new_shmmax < SIZE) {
+		tst_resm(TCONF,
+			"Test requires more than 2GB of RAM or need a lager 'shmmax' value for
 testing");
 		tst_exit();
 	}
@@ -150,4 +156,6 @@ void setup(void)
 void cleanup(void)
 {
 	set_sys_tune("nr_hugepages", orig_hugepages, 0);
+	SAFE_FILE_PRINTF(NULL, PATH_SHMMAX, "%ld", orig_shmmax);
+
 }
--

1.8.3.1

Quoted 11 lines

------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that you need to offload your IT needs and focus on growing your business. Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list