On Fri, Oct 10, 2008 at 12:17:28PM +0100, Mel Gorman wrote:
> On (09/10/08 20:20), Andy Whitcroft didst pronounce:
> > Rename and export the pool counter update interface.
> > 
> > Signed-off-by: Andy Whitcroft <[EMAIL PROTECTED]>
> > ---
> >  hugetlbfs.h |    2 ++
> >  hugeutils.c |   28 ++++++++++++++--------------
> >  2 files changed, 16 insertions(+), 14 deletions(-)
> > 
> > diff --git a/hugetlbfs.h b/hugetlbfs.h
> > index 2103515..fbff43b 100644
> > --- a/hugetlbfs.h
> > +++ b/hugetlbfs.h
> > @@ -70,6 +70,8 @@ enum {                     /* The number of pages of a 
> > given size that ... */
> >     HUGEPAGES_MAX_COUNTERS,
> >  };
> >  long get_huge_page_counter(long pagesize, unsigned int counter);
> > +int set_huge_page_counter(long pagesize, unsigned int counter,
> > +                                                   unsigned long val);
> >  int set_nr_hugepages(long pagesize, unsigned long val);
> >  int set_nr_overcommit_hugepages(long pagesize, unsigned long val);
> >  long read_meminfo(const char *tag);
> > diff --git a/hugeutils.c b/hugeutils.c
> > index e5032da..21f788d 100644
> > --- a/hugeutils.c
> > +++ b/hugeutils.c
> > @@ -190,7 +190,7 @@ long file_read_ulong(char *file, const char *tag)
> >             p = buf;
> >  
> >     val = strtol(p, &q, 0);
> > -   if (! isspace(*q)) {
> > +   if (*q && ! isspace(*q)) {
> >             ERROR("Couldn't parse %s value\n", file);
> >             return -1;
> >     }
> 
> Does this hunk belong here?

Its really a bug fix as we rely on there being a newline on the end of
the file.  We should never hit this issue other than when debugging with
real files.  So I'll pull it out to the debugging patches.

> > @@ -257,17 +257,6 @@ int select_pool_counter(unsigned int counter, unsigned 
> > long pagesize,
> >     return 0;
> >  }
> >  
> > -int set_pool_counter(unsigned long pagesize, unsigned int counter,
> > -                   unsigned long val)
> > -{
> > -   char file[PATH_MAX+1];
> > -
> > -   if (select_pool_counter(counter, pagesize, file, NULL))
> > -           return -1;
> > -
> > -   return file_write_ulong(file, val);
> > -}
> > -
> >  static int hpage_size_to_index(unsigned long size)
> >  {
> >     int i;
> > @@ -711,14 +700,25 @@ long get_huge_page_counter(long pagesize, unsigned 
> > int counter)
> >     return file_read_ulong(file, key);
> >  }
> >  
> > +int set_huge_page_counter(long pagesize, unsigned int counter,
> > +                   unsigned long val)
> > +{
> > +   char file[PATH_MAX+1];
> > +
> > +   if (select_pool_counter(counter, pagesize, file, NULL))
> > +           return -1;
> > +
> > +   return file_write_ulong(file, val);
> > +}
> > +
> 
> The rename I get, why the move?

It gets moved because it is now exposed.  There are 'sections' of this file
for those which are private, exported, and exported for tests/debugging
only.  By exposing it it should now be in a different part of the file.

> >  int set_nr_hugepages(long pagesize, unsigned long val)
> >  {
> > -   return set_pool_counter(pagesize, HUGEPAGES_TOTAL, val);
> > +   return set_huge_page_counter(pagesize, HUGEPAGES_TOTAL, val);
> >  }
> >  
> >  int set_nr_overcommit_hugepages(long pagesize, unsigned long val)
> >  {
> > -   return set_pool_counter(pagesize, HUGEPAGES_OC, val);
> > +   return set_huge_page_counter(pagesize, HUGEPAGES_OC, val);
> >  }
> >  
> >  /********************************************************************/
> 
> Otherwise, seems ok

-apw

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