Module pagesize

Source
Expand description

Helpers to calculate values derived from page size.

This has performance benefits from:

  • Avoiding calling sysconf(_SC_PAGESIZE) multiple times by caching the shift bit.
  • Using the (faster) shift instruction instead of (slower) multiply/divide instruction.

Constants§

TRANSPARENT_HUGEPAGE_SIZE_PATH 🔒

Statics§

PAGESIZE_SHIFT 🔒
THP_SIZE
The transparent hugepage size loaded from /sys/kernel/mm/transparent_hugepage/hpage_pmd_size.

Functions§

addr_to_page_idx
The page index of the page which contains the “addr”.
bytes_to_pages
Converts the bytes to number of pages.
is_hugepage_aligned
Returns whether the address/size is aligned with hugepage.
is_page_aligned
Returns whether the address/size is aligned with page.
load_transparent_hugepage_size 🔒
page_base_addr
The head address of the page which contains the “addr”.
page_idx_to_addr
The head address of the page.
pages_to_bytes
Converts number of pages to byte size.
round_up_hugepage_size
Rounds up the address/size with the hugepage size.