This patch adds a basic manual page for get_huge_pages() and free_huge_pages().
Signed-off-by: Mel Gorman <[EMAIL PROTECTED]> --- Makefile | 8 ++++++ man/get_huge_pages.3 | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+), 0 deletions(-) create mode 100644 man/get_huge_pages.3 diff --git a/Makefile b/Makefile index 0190222..8b05c74 100644 --- a/Makefile +++ b/Makefile @@ -6,6 +6,7 @@ INSTALL_OBJ_LIBS = libhugetlbfs.so libhugetlbfs.a BIN_OBJ_DIR=obj INSTALL_BIN = hugectl hugeedit INSTALL_HEADERS = hugetlbfs.h +INSTALL_MAN3 = get_huge_pages.3 INSTALL_MAN7 = libhugetlbfs.7 INSTALL_MAN8 = hugectl.8 hugeedit.8 LDSCRIPT_TYPES = B BDT @@ -110,6 +111,7 @@ LDSCRIPTDIR = $(PREFIX)/share/libhugetlbfs/ldscripts BINDIR = $(PREFIX)/share/libhugetlbfs EXEDIR = $(PREFIX)/bin DOCDIR = $(PREFIX)/share/doc/libhugetlbfs +MANDIR3 = $(PREFIX)/man/man3 MANDIR7 = $(PREFIX)/man/man7 MANDIR8 = $(PREFIX)/man/man8 @@ -299,6 +301,12 @@ install: libs tools $(OBJDIRS:%=%/install) $(INSTALL_OBJSCRIPT:%=objscript.%) for x in $(INSTALL_OBJSCRIPT); do \ $(INSTALL) -m 755 objscript.$$x $(DESTDIR)$(BINDIR)/$$x; done @$(VECHO) INSTALLMAN $(DESTDIR)manX + for x in $(INSTALL_MAN3); do \ + $(INSTALL) -m 444 man/$$x $(DESTDIR)$(MANDIR3); \ + gzip -f $(DESTDIR)$(MANDIR3)/$$x; \ + done + rm -f $(DESTDIR)$(MANDIR3)/free_huge_pages.3.gz + ln -s $(DESTDIR)$(MANDIR3)/get_huge_pages.3.gz $(DESTDIR)$(MANDIR3)/free_huge_pages.3.gz for x in $(INSTALL_MAN7); do \ $(INSTALL) -m 444 man/$$x $(DESTDIR)$(MANDIR7); \ gzip -f $(DESTDIR)$(MANDIR7)/$$x; \ diff --git a/man/get_huge_pages.3 b/man/get_huge_pages.3 new file mode 100644 index 0000000..ad22a2d --- /dev/null +++ b/man/get_huge_pages.3 @@ -0,0 +1,68 @@ +.\" Hey, EMACS: -*- nroff -*- +.\" First parameter, NAME, should be all caps +.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection +.\" other parameters are allowed: see man(7), man(1) +.TH GET_HUGE_PAGES 3 "October 8, 2008" +.\" Please adjust this date whenever revising the manpage. +.\" +.\" Some roff macros, for reference: +.\" .nh disable hyphenation +.\" .hy enable hyphenation +.\" .ad l left justify +.\" .ad b justify to both left and right margins +.\" .nf disable filling +.\" .fi enable filling +.\" .br insert line break +.\" .sp <n> insert n+1 empty lines +.\" for manpage-specific macros, see man(7) +.SH NAME +get_huge_pages, free_huge_pages \- Allocate and free memory regions backed by hugepages +.SH SYNOPSIS +.B #include <hugetlbfs.h> +.br + +.br +.B void *get_huge_pages(size_t len, ghp_t flags); +.br +.B void free_huge_pages(void *ptr); +.SH DESCRIPTION + +\fBget_huge_pages()\fP allocates a memory region \fBlen\fP bytes in size +backed by hugepages. Hugepages may be of benefit to applications that use +large amounts of address space and suffer a performance hit due to TLB +misses. Wall-clock time or oprofile can be used to determine if there is +a performance benefit from using hugepages or not. + +The \fBflags\fP argument changes the behaviour +of the function. Flags may be or'd together. + +.TP +.B GHP_DEFAULT +Allocate a region of memory of the requested length backed by +hugepages. Return NULL if sufficient pages are not available + +.TP +.B GHP_FALLBACK +Allocate a region of memory backed by hugepages. If sufficient hugepages are +not available, return an MAP_ANONYMOUS region of memory backed by small pages +instead. + +.PP + +\fBfree_huge_pages()\fP frees a region of memory allocated by +\fBget_huge_pages()\fP. The behaviour of the function if another pointer +is used, valid or otherwise, is undefined. + +.SH RETURN VALUE + +For \fBget_huge_pages()\fP, return a pointer to the allocated memory. On +error, NULL is returned. + +.SH SEE ALSO +.I oprofile(1) +, +.I libhugetlbfs(7) +.SH AUTHORS +libhugetlbfs was written by various people on the libhugetlbfs-devel +mailing list. + -- 1.5.6.5 ------------------------------------------------------------------------- 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