On Fri, 2008-10-03 at 18:37 +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.
> 
> Signed-off-by: Andy Whitcroft <[EMAIL PROTECTED]>
> ---
>  hpoolcfg.c |   40 ++++++++++++++++++++++++++++++++++++++--
>  1 files changed, 38 insertions(+), 2 deletions(-)
> 
> diff --git a/hpoolcfg.c b/hpoolcfg.c
> index 46e8de4..e9ac665 100644
> --- a/hpoolcfg.c
> +++ b/hpoolcfg.c
> @@ -50,6 +50,9 @@ void print_usage()
> 
>       OPTION("--pool-list", "List all pools");
> 
> +     OPTION("--page-sizes", "List all available page sizes");
> +     OPTION("--page-sizes-all", "List all supported page sizes");
> +
>       OPTION("--help, -h", "Prints this message");
>  }
> 
> @@ -61,6 +64,10 @@ int opt_dry_run = 0;
>  #define LONG_POOL    ('p' << 8)
>  #define LONG_POOL_LIST       (LONG_POOL|'l')
> 
> +#define LONG_PAGE    ('P' << 8)
> +#define LONG_PAGE_SIZES      (LONG_PAGE|'s')
> +#define LONG_PAGE_AVAIL      (LONG_PAGE|'a')
> +
>  #define MAX_POOLS    32
>  void pool_list(void)
>  {
> @@ -74,14 +81,32 @@ void pool_list(void)
>               exit(EXIT_FAILURE);
>       }
> 
> -     printf("%10s   %8s %8s %8s\n", "Size", "Minimum", "Current", "Maximum");
> +     printf("%10s %8s %8s %8s\n", "Size", "Minimum", "Current", "Maximum");
>       for (pos = 0; cnt--; pos++) {
> -             printf("%10ldkB %8ld %8ld %8ld\n", pools[pos].pagesize_kb,
> +             printf("%10ld %8ld %8ld %8ld\n", pools[pos].pagesize_kb,
>                       pools[pos].minimum, pools[pos].size,
>                       pools[pos].maximum);
>       }
>  }
> 
> +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);
> +     }
> +
> +     for (pos = 0; cnt--; pos++) {
> +             if (all || pools[pos].maximum)
> +                     printf("%ld\n", pools[pos].pagesize_kb);
> +     }
> +}
> +

I don't particularly like the definition of an available size you
propose here.  I think (at a minimum) an accessible mount point must
also exist for the size to classify it as available.  You can use
hugetlbfs_find_path_for_size() to check if there is a mount.

-- 
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