mem/hugeshmat04: check if system 'shmmax' large enough
PATCH 1/1 mem/hugeshmat04: check if system 'shmmax' large enough
Sometimes, the testcase fail like:
hugeshmat04 0 TINFO : set nr_hugepages to 512 hugeshmat04 1 TBROK : hugeshmat04.c:103: shmget: errno=EINVAL(22): Invalid argument hugeshmat04 2 TBROK : hugeshmat04.c:103: Remaining cases broken hugeshmat04 0 TINFO : set nr_hugepages to 0
The testbed info:
# cat /proc/sys/kernel/shmmax 536870912 # uname -r 3.10.0-295.el7.x86_64
The reason is that the 'shmmax' of a system is not enough for shmget() function to get 1G memory. On RHEL7 system, we have a BUG to enlarge this value, but I can't guarantee this programe could running well with other distribution. So, a proposed path as follow:
--- testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c +5 -3
@@ -123,13 +123,15 @@ void shared_hugepage(void)void setup (void ) { -long mem_total, hpage_size; +long mem_total, hpage_size, shmmax;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" , &shmmax); +if (mem_total <2L *1024 *1024 || shmmax <SIZE ) { +tst_resm (TCONF , +"Test requires more than 2GB of RAM or need a lager 'shmmax' value for testing" );tst_exit (); }
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
Oops! Seems like skip the test is not the best way. We should better, at least one times, to enlarge the 'shmmax' to an appropriate values and then try...
So I'm sorry, pls ignore this one, I will post a V2.
-----------
# ./hugeshmat04 hugeshmat04 0 TINFO : set nr_hugepages to 1024 hugeshmat04 1 TBROK : hugeshmat04.c:103: shmget: errno=EINVAL(22): Invalid argument hugeshmat04 2 TBROK : hugeshmat04.c:103: Remaining cases broken hugeshmat04 0 TINFO : set nr_hugepages to 512 # cat /proc/sys/kernel/shmmax 1073741823
# echo 1073741824 >/proc/sys/kernel/shmmax # ./hugeshmat04 hugeshmat04 0 TINFO : set nr_hugepages to 1024 hugeshmat04 1 TPASS : No regression found. hugeshmat04 2 TPASS : No regression found. hugeshmat04 3 TPASS : No regression found. hugeshmat04 0 TINFO : set nr_hugepages to 512
Signature · 6 lines
Regards, Li Wang Email: [email protected] ----- Original Message -----
Quoted 53 lines
Sometimes, the testcase fail like:
hugeshmat04 0 TINFO : set nr_hugepages to 512 hugeshmat04 1 TBROK : hugeshmat04.c:103: shmget: errno=EINVAL(22):Invalid argument
hugeshmat04 2 TBROK : hugeshmat04.c:103: Remaining cases broken
hugeshmat04 0 TINFO : setnr_hugepagesto 0The testbed info:
# cat /proc/sys/kernel/shmmax 536870912 # uname -r 3.10.0-295.el7.x86_64The reason is that the 'shmmax' of a system is not enough for
shmget()function to get 1G memory.
On RHEL7 system, we have a BUG to enlarge this value, but I can't guarantee this programe could
running well with other distribution. So, a proposed path as follow:Signed-off-by Li Wang <[email protected]>--- testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c +5
-4@@ -123,13 +123,15 @@ void shared_hugepage(void)void setup (void ) { -long mem_total, hpage_size; +long mem_total, hpage_size, shmmax;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" , &shmmax); +if (mem_total <2L *1024 *1024 || shmmax <SIZE ) { +tst_resm (TCONF , +"Test requires more than 2GB of RAM or need a lager 'shmmax' value for testing");tst_exit (); } --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
------------------------------------------------------------------------------
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