aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric B Munson <emunson@mgebm.net>2011-12-07 10:39:01 -0500
committerEric B Munson <emunson@mgebm.net>2011-12-15 14:50:19 -0500
commitd189f80a2900e9339c8e61cba6710829ecf73158 (patch)
treedaae73bcc58dcfa36724e3c6b2c83ab638c63904
parentecc196be536837d72739f033795553dfdcc328ce (diff)
downloadlibhugetlbfs-d189f80a2900e9339c8e61cba6710829ecf73158.tar.gz
Add controls to hugectl for new THP related env variables
This patch adds controls for the new THP related functionality in the library. Signed-off-by: Eric B Munson <emunson@mgebm.net> Acked-by: Andrew Hastings <abh@cray.com> Cc: abh@cray.com Cc: daivd@gibson.dropbear.id.au
-rw-r--r--hugectl.c17
-rw-r--r--man/hugectl.85
2 files changed, 21 insertions, 1 deletions
diff --git a/hugectl.c b/hugectl.c
index e2a9828..741247f 100644
--- a/hugectl.c
+++ b/hugectl.c
@@ -67,6 +67,10 @@ void print_usage()
OPTION("--heap[=<size>]", "Requests remapping of the program heap");
CONT("(malloc space)");
OPTION("--shm", "Requests remapping of shared memory segments");
+ OPTION("--thp", "Setup the heap space to be aligned for merging");
+ CONT("by khugepaged into huge pages. This requires");
+ CONT("kernel support for transparent huge pages to be");
+ CONT("enabled");
OPTION("--no-preload", "Disable preloading the libhugetlbfs library");
OPTION("--no-reserve", "Disable huge page reservation for segments");
@@ -171,6 +175,8 @@ void verbose_expose(void)
#define LONG_NO_LIBRARY (LONG_BASE | 'L')
#define LONG_LIBRARY (LONG_BASE | 'l')
+#define LONG_THP_HEAP ('t')
+
/*
* Mapping selectors, one per remappable/backable area as requested
* by the user. These are also used as returns from getopts where they
@@ -341,6 +347,7 @@ int main(int argc, char** argv)
int opt_preload = 1;
int opt_no_reserve = 0;
int opt_share = 0;
+ int opt_thp_heap = 0;
char *opt_library = NULL;
char opts[] = "+hvq";
@@ -365,7 +372,7 @@ int main(int argc, char** argv)
{"bss", optional_argument, NULL, MAP_BASE|MAP_BSS},
{"heap", optional_argument, NULL, MAP_BASE|MAP_HEAP},
{"shm", optional_argument, NULL, MAP_BASE|MAP_SHM},
-
+ {"thp", no_argument, NULL, LONG_THP_HEAP},
{0},
};
@@ -398,6 +405,11 @@ int main(int argc, char** argv)
quiet();
break;
+ case LONG_THP_HEAP:
+ opt_thp_heap = 1;
+ INFO("Aligning heap for use with THP\n");
+ break;
+
case LONG_NO_PRELOAD:
opt_preload = 0;
INFO("LD_PRELOAD disabled\n");
@@ -464,6 +476,9 @@ int main(int argc, char** argv)
if (opt_share)
setup_environment("HUGETLB_SHARE", "1");
+ if (opt_thp_heap)
+ setup_environment("HUGETLB_MORECORE", "thp");
+
if (opt_dry_run)
exit(EXIT_SUCCESS);
diff --git a/man/hugectl.8 b/man/hugectl.8
index 319742e..6ee70f2 100644
--- a/man/hugectl.8
+++ b/man/hugectl.8
@@ -63,6 +63,11 @@ Request that multiple application instances share text segments that are
backed with huge pages. This option sets the environment variable
HUGETLB_SHARE to 1.
+.TP
+.B --thp
+Align heap regions to huge page size for promotion by khugepaged. For more
+information on transparent huge pages see linux-2.6/Documentation/transhuge.txt
+
.PP
The following options affect how \fBhugectl\fP behaves.