On (30/06/08 14:13), David Gibson didst pronounce:
> On Fri, Jun 27, 2008 at 06:44:59PM +0100, Mel Gorman wrote:
> > HUGETLB_MORECORE currently exists to allow glibc to back malloc() with
> > large pages instead of small pages. However, not all applications use glibc
> > malloc() nor is it always desirable to back malloc() with huge pages. There
> > exists a requirement that a hugepage-aware application be able to allocate
> > hugepages directly.
> > 
> > Currently, each application is expected to discover the filesystem 
> > themselves,
> > mmap() the file and other house-keeping tasks. libhugetlbfs already 
> > implements
> > much of this complex logic internally. This patch exposes a simple API for 
> > the
> > allocation and freeing of regions backed by hugepages. The implementation is
> > a little over-simplistic but can be optimised later if and when applications
> > perceive its performance to be a bottleneck. The API itself should not need
> > to change as a multi-page aware API would be an additional rather than a
> > replacement interface.
> > 
> > Changelog since V1
> > o Rename hugepages_malloc() to get_huge_pages()
> > o Use %zd for size_t arguement
> > o Close leaking FD on mmap() failure
> > o Drop GFP_FORCELARGE and introduce GHP_DEFAULT
> > 
> > Signed-off-by: Mel Gorman <[EMAIL PROTECTED]>
> 
> Acked-by: David Gibson <[EMAIL PROTECTED]>
> 

Thanks

> [snip]
> > diff -rup -X /usr/src/patchset-0.6/bin//dontdiff 
> > libhugetlbfs-clean/hugetlbfs.h libhugetlbfs-userspace-alloc/hugetlbfs.h
> > --- libhugetlbfs-clean/hugetlbfs.h  2008-05-16 13:43:11.000000000 -0700
> > +++ libhugetlbfs-userspace-alloc/hugetlbfs.h        2008-06-27 
> > 10:25:02.000000000 -0700
> > @@ -33,4 +33,17 @@ long dump_proc_pid_maps(void);
> >  
> >  #define PF_LINUX_HUGETLB   0x100000
> >  
> > +/*
> > + * Direct alloc flags and types
> > + *
> > + * GFP_DEFAULT - Use a combination of flags deemed to be a sensible default
> 
> ITYM GHP_DEFAULT.
> 

Opps, corrected. Will post V3 soon.

> > + *                 by the current implementation of the library
> > + */
> > +typedef unsigned long ghp_t;
> > +#define GHP_DEFAULT        (0)
> > +
> > +/* Direct alloc functions */
> > +void *get_huge_pages(size_t len, ghp_t flags);
> > +void free_huge_pages(void *ptr);
> 
> 
> [snip
> >  
> > -LIBOBJS = hugeutils.o version.o init.o morecore.o debug.o
> > +LIBOBJS = hugeutils.o version.o init.o morecore.o debug.o alloc.o
> >  INSTALL_OBJ_LIBS = libhugetlbfs.so libhugetlbfs.a
> > +INSTALL_HEADERS = hugetlbfs.h
> >  LDSCRIPT_TYPES = B BDT
> >  LDSCRIPT_DIST_ELF = elf32ppclinux elf64ppc elf_i386 elf_x86_64
> >  INSTALL_OBJSCRIPT = ld.hugetlbfs
> > @@ -89,6 +90,7 @@ endif
> >  LIBOBJS32 += $(LIBOBJS:%=obj32/%)
> >  LIBOBJS64 += $(LIBOBJS:%=obj64/%)
> >  
> > +HEADERDIR = $(PREFIX)/include
> >  LIBDIR32 = $(PREFIX)/$(LIB32)
> >  LIBDIR64 = $(PREFIX)/$(LIB64)
> >  LDSCRIPTDIR = $(PREFIX)/share/libhugetlbfs/ldscripts
> > @@ -254,6 +256,7 @@ objscript.%: %
> >  install: libs $(OBJDIRS:%=%/install) $(INSTALL_OBJSCRIPT:%=objscript.%)
> >     @$(VECHO) INSTALL
> >     $(INSTALL) -d $(DESTDIR)$(LDSCRIPTDIR)
> > +   $(INSTALL) -m 644 $(INSTALL_HEADERS) $(HEADERDIR)
> 
> 
> Oh.. we weren't installing the header file before now.  That was a bit
> broken.
> 

I think it reflects the assumption that no one really expected
libhugetlbfs to be used directly, even for the utility functions like
gethugepagesize. Housework like man pages will be needed as well.

-- 
Mel Gorman
Part-time Phd Student                          Linux Technology Center
University of Limerick                         IBM Dublin Software Lab

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Libhugetlbfs-devel mailing list
Libhugetlbfs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libhugetlbfs-devel

Reply via email to