Skip to content

Large Page Support in memory allocated by the GC #10476

@mjsabby

Description

@mjsabby

Large Pages (a.k.a Huge Pages on Linux) is a feature where the operating system is able to establish memory regions larger than the native page size (often 4K) to improve performance of the application requesting these large pages.

When a virtual-to-physical address translation occurs, a cache called the Translation lookaside buffer (TLB) is first consulted (often in parallel) to check if a physical translation for the virtual address being accessed is available to avoid doing a page-table walk which can be expensive.

A 4GB virtual address space is made up of 1048576 4K virtual pages. It could also be thought of to be represented as 2048 2MB virtual pages. Most modern os and cpus can operate on 4K or larger page sizes (2MB/4MB/1GB in x86_64).

On Windows VirtualAlloc must be called with MEM_RESERVE | MEM_COMMIT | MEM_LARGE_PAGES for the flAllocationType parameter. It is also required that process acquire the SeLockMemoryPrivilege privilege. Large Pages can also significantly increase the chance of a memory allocation failure because now the OS has to find physically contiguous memory.

What this means for coreclr and the GC is that when the GC does a VirtualReserve at the beginning of the program it must now commit this memory as well.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions