| 1 |
.\" Hey, EMACS: -*- nroff -*- |
| 2 |
.\" First parameter, NAME, should be all caps |
| 3 |
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection |
| 4 |
.\" other parameters are allowed: see man(7), man(1) |
| 5 |
.TH GET_HUGE_PAGES 3 "October 8, 2008" |
| 6 |
.\" Please adjust this date whenever revising the manpage. |
| 7 |
.\" |
| 8 |
.\" Some roff macros, for reference: |
| 9 |
.\" .nh disable hyphenation |
| 10 |
.\" .hy enable hyphenation |
| 11 |
.\" .ad l left justify |
| 12 |
.\" .ad b justify to both left and right margins |
| 13 |
.\" .nf disable filling |
| 14 |
.\" .fi enable filling |
| 15 |
.\" .br insert line break |
| 16 |
.\" .sp <n> insert n+1 empty lines |
| 17 |
.\" for manpage-specific macros, see man(7) |
| 18 |
.SH NAME |
| 19 |
get_huge_pages, free_huge_pages \- Allocate and free hugepages |
| 20 |
.SH SYNOPSIS |
| 21 |
.B #include <hugetlbfs.h> |
| 22 |
.br |
| 23 |
|
| 24 |
.br |
| 25 |
.B void *get_huge_pages(size_t len, ghp_t flags); |
| 26 |
.br |
| 27 |
.B void free_huge_pages(void *ptr); |
| 28 |
.SH DESCRIPTION |
| 29 |
|
| 30 |
\fBget_huge_pages()\fP allocates a memory region \fBlen\fP bytes in size |
| 31 |
backed by hugepages. Hugepages may be of benefit to applications that use |
| 32 |
large amounts of address space and suffer a performance hit due to TLB |
| 33 |
misses. Wall-clock time or oprofile can be used to determine if there is |
| 34 |
a performance benefit from using hugepages or not. |
| 35 |
|
| 36 |
The \fBlen\fP parameter must be hugepage-aligned. In the current |
| 37 |
implementation, only the default hugepage size may be allocated via this |
| 38 |
function. Use \fBgethugepagesize\fP to discover what the alignment should |
| 39 |
be. |
| 40 |
|
| 41 |
The \fBflags\fP argument changes the behaviour |
| 42 |
of the function. Flags may be or'd together. |
| 43 |
|
| 44 |
.TP |
| 45 |
.B GHP_DEFAULT |
| 46 |
|
| 47 |
Allocate a region of memory of the requested length backed by hugepages of |
| 48 |
the default hugepage size. Return NULL if sufficient pages are not available |
| 49 |
|
| 50 |
.PP |
| 51 |
|
| 52 |
\fBfree_huge_pages()\fP frees a region of memory allocated by |
| 53 |
\fBget_huge_pages()\fP. The behaviour of the function if another pointer |
| 54 |
is used, valid or otherwise, is undefined. |
| 55 |
|
| 56 |
.SH RETURN VALUE |
| 57 |
|
| 58 |
On success, a pointer is returned to the allocated memory. On |
| 59 |
error, NULL is returned. errno will be set based on what the failure of |
| 60 |
mmap() was due to. |
| 61 |
|
| 62 |
.SH SEE ALSO |
| 63 |
.I oprofile(1) |
| 64 |
, |
| 65 |
.I gethugepagesize(3) |
| 66 |
, |
| 67 |
.I get_hugepage_region(3) |
| 68 |
, |
| 69 |
.I libhugetlbfs(7) |
| 70 |
.SH AUTHORS |
| 71 |
libhugetlbfs was written by various people on the libhugetlbfs-devel |
| 72 |
mailing list. |
| 73 |
|