On Thu, Feb 19, 2009 at 11:49:55AM +0000, Eric B Munson wrote: > This adds a check when the pool is being resized that will warn > the user about possible resize failures if no swap space is > configured or swap is full. > > Signed-off-by: Eric B Munson <ebmun...@us.ibm.com> > --- > hugeadm.c | 18 ++++++++++++++++++ > 1 files changed, 18 insertions(+), 0 deletions(-) > > diff --git a/hugeadm.c b/hugeadm.c > index 876ba55..55656ba 100644 > --- a/hugeadm.c > +++ b/hugeadm.c > @@ -60,6 +60,8 @@ extern char *optarg; > #define MAX_SIZE_MNTENT (64 + PATH_MAX + 32 + 128 + 2 * sizeof(int)) > #define FORMAT_LEN 20 > > +#define SWAP_FREE "SwapFree:" > + > void print_usage() > { > fprintf(stderr, "hugeadm [options]\n"); > @@ -418,6 +420,20 @@ void create_mounts(char *user, char *group, char *base, > mode_t mode) > } > } > > +/** > + * check_swap shouldn't change the behavior of any of its > + * callers, it only prints a message to the user if something > + * is being done that might fail without swap available. i.e. > + * resizing a huge page pool > + */ > +void check_swap() > +{ > + /* TODO: Move these messages to an external resource. */
That's a general TODO really and not specific to this feature. There would need to be some sort of configurable logging channel but it's a fairly sizable effort. > + long swap_sz = read_meminfo(SWAP_FREE); > + if (swap_sz <= 0) Can swap size be < 0? > + WARNING("Swap is full or no swap space configured, resizing > pool may fail.\n"); > +} You could easily distinguish between these two cases, right? Ideally there would be anote on this topic in the documentation as well but it's not mandatory. > + > enum { > POOL_MIN, > POOL_MAX, > @@ -495,6 +511,8 @@ void pool_adjust(char *cmd, unsigned int counter) > exit(EXIT_FAILURE); > } > > + check_swap(); > + > min = pools[pos].minimum; > max = pools[pos].maximum; > Preferably it would distinguish between full swap and no swap but otherwise it looks good. -- Mel Gorman Part-time Phd Student Linux Technology Center University of Limerick IBM Dublin Software Lab ------------------------------------------------------------------------------ Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are powering Web 2.0 with engaging, cross-platform capabilities. Quickly and easily build your RIAs with Flex Builder, the Eclipse(TM)based development software that enables intelligent coding and step-through debugging. Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com _______________________________________________ Libhugetlbfs-devel mailing list Libhugetlbfs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libhugetlbfs-devel