On (09/10/08 20:20), Andy Whitcroft didst pronounce: > 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]>
Acked-by: Mel Gorman <[EMAIL PROTECTED]> > --- > hpoolcfg.c | 37 +++++++++++++++++++++++++++++++++++++ > 1 files changed, 37 insertions(+), 0 deletions(-) > > diff --git a/hpoolcfg.c b/hpoolcfg.c > index 8b70389..0fe3482 100644 > --- a/hpoolcfg.c > +++ b/hpoolcfg.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 > void pool_list(void) > { > @@ -153,6 +161,24 @@ void pool_adjust(char *cmd, unsigned int counter) > set_huge_page_counter(page_size, counter, adjust); > } > > +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); > + } > +} > + > int main(int argc, char** argv) > { > char opts[] = "+h"; > @@ -164,6 +190,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}, > }; > > @@ -195,6 +224,14 @@ int main(int argc, char** argv) > pool_adjust(optarg, HUGEPAGES_OC); > 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; > -- > 1.6.0.1.451.gc8d31 > -- Mel Gorman Part-time Phd Student Linux Technology Center University of Limerick IBM Dublin Software Lab ------------------------------------------------------------------------- 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