On Mon, Mar 30, 2009 at 06:54:51PM +0100, Eric B Munson wrote: > Sorry for the resend, earlier patch did not include sample output. > > 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 <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;
Acked-by: Mel Gorman <m...@csn.ul.ie> -- Mel Gorman Part-time Phd Student Linux Technology Center University of Limerick IBM Dublin Software Lab ------------------------------------------------------------------------------ _______________________________________________ Libhugetlbfs-devel mailing list Libhugetlbfs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libhugetlbfs-devel