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.

Signed-off-by: Eric B Munson <ebmun...@us.ibm.com>
---
 hugeadm.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/hugeadm.c b/hugeadm.c
index 2e99b44..9742323 100644
--- a/hugeadm.c
+++ b/hugeadm.c
@@ -98,6 +98,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");
 }
 
@@ -125,6 +128,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)
@@ -606,6 +611,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;
@@ -631,6 +646,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},
        };
@@ -721,6 +737,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
Libhugetlbfs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libhugetlbfs-devel

Reply via email to