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:
emun...@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:
emun...@lappy-486:~$
Second, configured mount with pages available:
emun...@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
emun...@lappy-486:~$
Last, no swap available:
emun...@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.
emun...@lappy-486:~$
Signed-off-by: Eric B Munson <[email protected]>
---
hugeadm.c | 20 ++++++++++++++++++++
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;
--
1.6.1.2
------------------------------------------------------------------------------
_______________________________________________
Libhugetlbfs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libhugetlbfs-devel