Hi, > From: "Zhouping Liu" <z...@redhat.com> > To: "LTP list" sourceforge.net> > Sent: Saturday, July 7, 2012 11:14:38 PM > Subject: [LTP] [PATCH] hugetlb: add a new function get_available_hugepages > > on some systems with small RAM, there aren't enough memory > to set as specific hugepages, such as 128 hugepages, it will > fail like this: > [root@localhost hugemmap]# ./hugemmap01 > hugemmap01 0 TINFO : set nr_hugepages to 128 > hugemmap01 1 TBROK : nr_hugepages = 55, but expect 128 > hugemmap01 2 TBROK : Remaining cases broken > hugemmap01 0 TINFO : set nr_hugepages to 54 > > we can detect whether the system has the power to get the specific > hugepages through the following commands: > > [root@localhost hugemmap]# echo 128 > /proc/sys/vm/nr_hugepages > [root@localhost hugemmap]# cat /proc/sys/vm/nr_hugepages > 55 > > as we know, on this system, there are 55 available hugepages, so we > can set 55 hugepages to continue the case, but to exit the case, > and this is desinged into get_available_hugepages() functions.
I have tested on some systems. a. test on a low memory: [root@localhost hugemmap]# ./hugemmap01 hugemmap01 0 TINFO : set nr_hugepages to 128 hugemmap01 0 TINFO : There're 56 available hugepages hugemmap01 0 TINFO : set nr_hugepages to 56 hugemmap01 1 TPASS : call succeeded hugemmap01 0 TINFO : set nr_hugepages to 0 b. try to set overcommit hugepages: [root@localhost hugemmap]# ./hugemmap01 -s 1000 hugemmap01 0 TINFO : set nr_hugepages to 1000 hugemmap01 0 TINFO : There're 363 available hugepages hugemmap01 0 TINFO : set nr_hugepages to 363 hugemmap01 1 TPASS : call succeeded hugemmap01 0 TINFO : set nr_hugepages to 0 Thanks, Zhouping ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list