Skip to contentSkip to conversation

overcommit libhugetlbfs and check the statistics

PATCH In review [email protected] 2 participants 2 messages Dec 7, 2010 – Dec 30, 2010 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 1108110757.253081291707011009.JavaMail.root@zmail06.collab.prod.int.phx2.redhat.com

#1 lore raw

PATCH v6 1/1 overcommit libhugetlbfs and check the statistics

libhugetlbfs allows to overcommit hugepages and there are tunables in sysfs and procfs. The test here want to ensure it is possible to overcommit by either mmap or shared memory. Also ensure those reservation can be read/write, and several statistics work correctly.

First, it resets nr_hugepages and nr_overcommit_hugepages. Then, set both to a specify value - N, and allocate N + %50 x N hugepages. Finally, it reads and writes every page. There are command options to choose either to manage hugepages from sysfs or procfs, and reserve them by mmap or shmget.

---
v6: more code cleanup
v5: code cleanup
v4: cleanup from Garrett's feedback.
v3: fix -a option description; fix a nasty bug with tst_exit which skips
cleanup at the end of the test; add more information to assist test debug.
v2: add more explanation and a command-line option to specify memory
allocation size.

---
 runtest/mm                                         |    5 +
 testcases/kernel/mem/hugetlb/hugemmap/hugemmap05.c |  451 ++++++++++++++++++++
 2 files changed, 456 insertions(+), 0 deletions(-)
 create mode 100644 testcases/kernel/mem/hugetlb/hugemmap/hugemmap05.c
runtest/mm +5 -0
index 8c65aeb..7abdf98 100644
@@ -61,3 +61,8 @@ mmap10_3 mmap10 -a -s
 mmap10_4 mmap10 -a -s -c 60
 
 ksm01 ksm01
+
+hugemmap05 hugemmap05
+hugemmap05_1 hugemmap05 -m
+hugemmap05_2 hugemmap05 -s
+hugemmap05_3 hugemmap05 -s -m
testcases/kernel/mem/hugetlb/hugemmap/hugemmap05.c new file +451 -0

451 lines not on this page · raw message

Signature · 1 line
1.7.3.2

libhugetlbfs allows to overcommit hugepages and there are tunables in sysfs and procfs. The test here want to ensure it is possible to overcommit by either mmap or shared memory. Also ensure those reservation can be read/write, and several statistics work correctly.

First, it resets nr_hugepages and nr_overcommit_hugepages. Then, set both to a specify value - N, and allocate N + %50 x N hugepages. Finally, it reads and writes every page. There are command options to choose either to manage hugepages from sysfs or procfs, and reserve them by mmap or shmget.

---
v6: more code cleanup
v5: code cleanup
v4: cleanup from Garrett's feedback.
v3: fix -a option description; fix a nasty bug with tst_exit which skips
cleanup at the end of the test; add more information to assist test debug.
v2: add more explanation and a command-line option to specify memory
allocation size.

---
 runtest/mm                                         |    5 +
 testcases/kernel/mem/hugetlb/hugemmap/hugemmap05.c |  451 ++++++++++++++++++++
 2 files changed, 456 insertions(+), 0 deletions(-)
 create mode 100644 testcases/kernel/mem/hugetlb/hugemmap/hugemmap05.c
runtest/mm +5 -0
index 8c65aeb..7abdf98 100644
@@ -61,3 +61,8 @@ mmap10_3 mmap10 -a -s
 mmap10_4 mmap10 -a -s -c 60
 
 ksm01 ksm01
+
+hugemmap05 hugemmap05
+hugemmap05_1 hugemmap05 -m
+hugemmap05_2 hugemmap05 -s
+hugemmap05_3 hugemmap05 -s -m
testcases/kernel/mem/hugetlb/hugemmap/hugemmap05.c new file +451 -0

451 lines not on this page · raw message

Signature · 1 line
1.7.3.2

------------------------------------------------------------------------------
What happens now with your Lotus Notes apps - do you make another costly upgrade, or settle for being marooned without product support? Time to move off Lotus Notes and onto the cloud with Force.com, apps are easier to build, use, and manage than apps on traditional platforms. Sign up for the Lotus Notes Migration Kit to learn more. http://p.sf.net/sfu/salesforce-d2d

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

#2 lore raw
Quoted 4 lines
testcases/kernel/mem/hugetlb/hugemmap/hugemmap05.c new file +4 -0
+#define PROTECTION		(PROT_READ | PROT_WRITE)
+#define _PATH_MEMINFO		"/proc/meminfo"
+#define _PATH_SYS_HUGE		"/sys/kernel/mm/hugepages"
+#define _PATH_SYS_2M		_PATH_SYS_HUGE "/hugepages-2048kB/"

testcases/kernel/mem/hugetlb/hugemmap/hugemmap05.c line 66

Quoted 10 lines
testcases/kernel/mem/hugetlb/hugemmap/hugemmap05.c new file +10 -0
+#define _PATH_SYS_2M_OVER	_PATH_SYS_2M "nr_overcommit_hugepages"
+#define _PATH_SYS_2M_FREE	_PATH_SYS_2M "free_hugepages"
+#define _PATH_SYS_2M_RESV	_PATH_SYS_2M "resv_hugepages"
+#define _PATH_SYS_2M_SURP	_PATH_SYS_2M "surplus_hugepages"
+#define _PATH_SYS_2M_HUGE	_PATH_SYS_2M "nr_hugepages"
+#define _PATH_PROC_VM		"/proc/sys/vm/"
+#define _PATH_PROC_OVER		_PATH_PROC_VM "nr_overcommit_hugepages"
+#define _PATH_PROC_HUGE		_PATH_PROC_VM "nr_hugepages"
+#define _PATH_SHMMAX		"/proc/sys/kernel/shmmax"
+#define MB			(1024 * 1024)

As I said before, names starting with uderscore are reserved for compiler/standard library implementation and should not be used unless you are writing compiler/standard library ;).

Signature · 13 lines
Cyril Hrubis
[email protected]

------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and, 
should the need arise, upgrade to a full multi-node Oracle RAC database 
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list