pub enum PageType {
Default,
Small,
TransparentHuge,
Huge2MB,
Huge16MB,
Huge1GB,
Huge16GB,
}
Expand description
Specifies the allocation page type
Linux supports multiple page sizes, as well as transparent huge pages.
PageType
configures type of pages (default, THP, HugeTLB) and page size
used for a memory allocation.
Additional steps required
Before huge pages can be allocated, they first must be enabled by the system administrator. For example, this can be done by running:
echo 20 > /proc/sys/vm/nr_overcommit_hugepages
Documentation
See the Linux kernel documentation on transparent huge pages and HugeTLB for details.
Variants
Default
The default page type
As configured in the operating system. Modern Linux systems usually have transparent huge pages enabled.
Small
Small pages
Forces the use of small pages with madvise
. Thus, small pages are
allocated even if transparent huge pages are enabled. The small page
size depends on the processor architecture. For x86_64 it’s 4 KiB, for
ppc64le it’s 64 KiB.
TransparentHuge
Transparent huge pages
Forces the use of transparent huge pages with madvise
, even if huge
pages are disabled.
Huge2MB
2 MiB huge pages
Allocates 2 MiB huge pages using HugeTLB with mmap
.
Huge16MB
16 MiB huge pages
Allocates 16 MiB huge pages using HugeTLB with mmap
.
Huge1GB
1 GiB huge pages
Allocates 1 GiB huge pages using HugeTLB with mmap
.
Huge16GB
16 GiB huge pages
Allocates 16 GiB huge pages using HugeTLB with mmap
.
Trait Implementations
impl Copy for PageType
impl Eq for PageType
impl StructuralEq for PageType
impl StructuralPartialEq for PageType
Auto Trait Implementations
impl RefUnwindSafe for PageType
impl Send for PageType
impl Sync for PageType
impl Unpin for PageType
impl UnwindSafe for PageType
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more