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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.