On Fri, 2008-10-10 at 16:58 +0100, Andy Whitcroft wrote:
> Expose possible page sizes.  Expose the page sizes which are available
> (have pages assigned to them) via --page-sizes.  Expose all possible page
> sizes (supported by the processor) via --page-sizes-all.  Page sizes are
> listed in numerical order.
> 
> Signed-off-by: Andy Whitcroft <[EMAIL PROTECTED]>
> Acked-by: Mel Gorman <[EMAIL PROTECTED]>
> ---
>  hugeadm.c |   38 ++++++++++++++++++++++++++++++++++++++
>  1 files changed, 38 insertions(+), 0 deletions(-)
> 
> diff --git a/hugeadm.c b/hugeadm.c
> index a590015..d067086 100644
> --- a/hugeadm.c
> +++ b/hugeadm.c
> @@ -54,6 +54,10 @@ void print_usage()
>       OPTION("--pool-pages-max <size>:[+|-]<count>", "");
>       CONT("Adjust pool 'size' upper bound");
> 
> +     OPTION("--page-sizes", "Display page sizes that a configured pool");
> +     OPTION("--page-sizes-all",
> +                     "Display page sizes support by the hardware");
> +
>       OPTION("--help, -h", "Prints this message");
>  }
> 
> @@ -67,6 +71,10 @@ int opt_dry_run = 0;
>  #define LONG_POOL_MIN_ADJ    (LONG_POOL|'m')
>  #define LONG_POOL_MAX_ADJ    (LONG_POOL|'M')
> 
> +#define LONG_PAGE    ('P' << 8)
> +#define LONG_PAGE_SIZES      (LONG_PAGE|'s')
> +#define LONG_PAGE_AVAIL      (LONG_PAGE|'a')
> +
>  #define MAX_POOLS    32
> 
>  static int cmpsizes(const void *p1, const void *p2)
> @@ -200,6 +208,25 @@ void pool_adjust(char *cmd, unsigned int counter)
>       }
>  }
> 
> +void page_sizes(int all)
> +{
> +     struct hpage_pool pools[MAX_POOLS];
> +     int pos;
> +     int cnt;
> +
> +     cnt = __lh_hpool_sizes(pools, MAX_POOLS);
> +     if (cnt < 0) {
> +             ERROR("unable to obtain pools list");
> +             exit(EXIT_FAILURE);
> +     }
> +     qsort(pools, cnt, sizeof(pools[0]), cmpsizes);
> +
> +     for (pos = 0; cnt--; pos++) {
> +             if (all || pools[pos].maximum)
> +                     printf("%ld\n", pools[pos].pagesize_kb);
> +     }

In the last round of review I suggested that the definition of a
'configured pool' should include an accessible mount point for the page
size.  I believe you agreed with that sentiment but I do not see it
coded here.

> +}
> +
>  int main(int argc, char** argv)
>  {
>       char opts[] = "+h";
> @@ -211,6 +238,9 @@ int main(int argc, char** argv)
>               {"pool-pages-min", required_argument, NULL, LONG_POOL_MIN_ADJ},
>               {"pool-pages-max", required_argument, NULL, LONG_POOL_MAX_ADJ},
> 
> +             {"page-sizes", no_argument, NULL, LONG_PAGE_SIZES},
> +             {"page-sizes-all", no_argument, NULL, LONG_PAGE_AVAIL},
> +
>               {0},
>       };
> 
> @@ -242,6 +272,14 @@ int main(int argc, char** argv)
>                       pool_adjust(optarg, POOL_MAX);
>                       break;
> 
> +             case LONG_PAGE_SIZES:
> +                     page_sizes(0);
> +                     break;
> +
> +             case LONG_PAGE_AVAIL:
> +                     page_sizes(1);
> +                     break;
> +
>               default:
>                       WARNING("unparsed option %08x\n", ret);
>                       ret = -1;
-- 
Adam Litke - (agl at us.ibm.com)
IBM Linux Technology Center


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Libhugetlbfs-devel mailing list
Libhugetlbfs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libhugetlbfs-devel

Reply via email to