GET_HUGE_PAGES(3)
π GET_HUGE_PAGES(3) π
okay bestie, welcome to the GET_HUGE_PAGES(3) manual page, aka the Library Functions Manual glow-up you didn't know you needed β¨
πΈ NAME πΈ
get_huge_pages, free_huge_pages β Allocate and free hugepages π«Ά
β¨ SYNOPSIS β¨
#include <hugetlbfs.h>
void *get_huge_pages(size_t len, ghp_t flags);
void free_huge_pages(void *ptr);
π DESCRIPTION π
so like, get_huge_pages() allocates a memory region len bytes in size backed by hugepages. no cap. π¦
hugepages may be of benefit to applications that use large amounts of address space and suffer a performance hit due to TLB misses. lowkey iconic. Wall-clock time or oprofile can be used to determine if there is a performance benefit from using hugepages or not. like, do your research bestie π
the len parameter must be hugepage-aligned, fr fr. and in the current implementation, only the default hugepage size may be allocated via this function π use gethugepagesize to discover what the alignment should be.
the flags argument changes the behaviour of the function. flags may be or'd together π
GHP_DEFAULTβ Allocate a region of memory of the requested length backed by hugepages of the default hugepage size. ReturnNULLif sufficient pages are not available π
free_huge_pages() frees a region of memory allocated by get_huge_pages(). π
β οΈ bestie the behaviour of the function if another pointer is used, valid or otherwise, is undefined. undefined behaviour is not the vibe. do not do it. periodt π
π RETURN VALUE π
On success, a pointer is returned to the allocated memory π On error, NULL is returned. errno will be set based on what the failure of mmap() was due to. yeah she's giving "blame the syscall" energy π
π¦ SEE ALSO π¦
π AUTHORS π
libhugetlbfs was written by various people on the libhugetlbfs-devel mailing list. shoutout to the whole group chat π
and that's the whole page, bestie β this one dropped way back on October 8, 2008, and it lives in the GET_HUGE_PAGES(3) section of the manual. slay π
β¨
π¦ where this page comes from
- debian bookworm: libhugetlbfs-dev 2.23-5 Β· LGPL-2.1-only
- debian trixie: libhugetlbfs-dev 2.24-1+b1 Β· LGPL-2.1-only
- nixpkgs unstable: libhugetlbfs 2.24
- opensuse-leap 16.0: libhugetlbfs-devel 2.24.0.g1322884-160000.3.2 Β· LGPL-2.1-or-later
- opensuse-leap 16.0: libhugetlbfs-devel 2.24.0.g1322884-160000.3.2 Β· LGPL-2.1-or-later
- opensuse-leap 16.0: libhugetlbfs-devel 2.24.0.g1322884-160000.3.2 Β· LGPL-2.1-or-later
- opensuse-leap 16.0: libhugetlbfs-devel 2.24.0.g1322884-160000.3.2 Β· LGPL-2.1-or-later
- ubuntu jammy: libhugetlbfs-dev 2.23-4 Β· LGPL-2.1-only
- ubuntu noble: libhugetlbfs-dev 2.23-5build1 Β· LGPL-2.1-only
- ubuntu questing: libhugetlbfs-dev 2.24-1
- ubuntu resolute: libhugetlbfs-dev 2.24-1build1 Β· LGPL-2.1-only
- ubuntu stonking: libhugetlbfs-dev 2.24-1build1 Β· LGPL-2.1-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms