aboutsummaryrefslogtreecommitdiff
path: root/hugeadm.c
diff options
context:
space:
mode:
authorEric B Munson <ebmunson@us.ibm.com>2009-03-31 14:26:15 +0100
committerEric B Munson <ebmunson@us.ibm.com>2009-03-31 14:55:29 +0100
commit9562448cc8b0d25933b93bffc5516aef4cf21e89 (patch)
treedff106354437688da326f0b56542112d30668174 /hugeadm.c
parent1fe8f9cefecb657b77dcf46a49737efb16b56dd0 (diff)
downloadlibhugetlbfs-9562448cc8b0d25933b93bffc5516aef4cf21e89.tar.gz
Add --explain to hugeadm
Add a switch to hugeadm that asks for a general report of huge page availablity on the system. It combines the output of the --list-all-mounts and --pool-list switches with a list of huge page sizes with configured pools. It will also let the user know if there is no swap configured that pool resizing is likely to fail. Here are some sample outputs: First, no configured mounts: emunson@lappy-486:~$ hugeadm --explain No hugetlbfs mount point found. Huge page pools: Size Minimum Current Maximum Default 4194304 0 0 0 * Huge page sizes with configured pools: emunson@lappy-486:~$ Second, configured mount with pages available: emunson@lappy-486:~$ hugeadm --explain Mount Point Options /var/lib/hugetlbfs/global/pagesize-4194304 rw,pagesize=4194304 Huge page pools: Size Minimum Current Maximum Default 4194304 30 30 30 * Huge page sizes with configured pools: 4194304 emunson@lappy-486:~$ Last, no swap available: emunson@lappy-486:~$ hugeadm --explain Mount Point Options /var/lib/hugetlbfs/global/pagesize-4194304 rw,pagesize=4194304 Huge page pools: Size Minimum Current Maximum Default 4194304 30 30 30 * Huge page sizes with configured pools: 4194304 hugeadm: WARNING: Swap is full or no swap space configured, resizing pool may fail. emunson@lappy-486:~$ Signed-off-by: Eric B Munson <ebmunson@us.ibm.com> Acked-by: Mel Gorman <mel@csn.ul.ie>
Diffstat (limited to 'hugeadm.c')
-rw-r--r--hugeadm.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/hugeadm.c b/hugeadm.c
index e713b9e..22f47a4 100644
--- a/hugeadm.c
+++ b/hugeadm.c
@@ -99,6 +99,9 @@ void print_usage()
CONT("the specified options would have done without");
CONT("taking any action");
+ OPTION("--explain", "Gives a overview of the status of the system");
+ CONT("with respect to huge page availability");
+
OPTION("--help, -h", "Prints this message");
}
@@ -126,6 +129,8 @@ int opt_hard = 0;
#define LONG_CREATE_GLOBAL_MOUNTS (LONG_MOUNTS|'G')
#define LONG_LIST_ALL_MOUNTS (LONG_MOUNTS|'A')
+#define LONG_EXPLAIN ('e' << 8)
+
#define MAX_POOLS 32
static int cmpsizes(const void *p1, const void *p2)
@@ -615,6 +620,16 @@ void page_sizes(int all)
}
}
+void explain()
+{
+ mounts_list_all();
+ printf("\nHuge page pools:\n");
+ pool_list();
+ printf("\nHuge page sizes with configured pools:\n");
+ page_sizes(0);
+ check_swap();
+}
+
int main(int argc, char** argv)
{
int ops;
@@ -640,6 +655,7 @@ int main(int argc, char** argv)
{"page-sizes", no_argument, NULL, LONG_PAGE_SIZES},
{"page-sizes-all", no_argument, NULL, LONG_PAGE_AVAIL},
{"dry-run", no_argument, NULL, 'd'},
+ {"explain", no_argument, NULL, LONG_EXPLAIN},
{0},
};
@@ -730,6 +746,10 @@ int main(int argc, char** argv)
page_sizes(1);
break;
+ case LONG_EXPLAIN:
+ explain();
+ break;
+
default:
WARNING("unparsed option %08x\n", ret);
ret = -1;