Support for pinned memory

AIX® enables memory pages to be maintained in real memory all the time. This mechanism is called pinning memory.

Pinning a memory region prohibits the pager from stealing pages from the pages backing the pinned memory region. Memory regions defined in either system space or user space may be pinned. After a memory region is pinned, accessing that region does not result in a page fault until the region is subsequently unpinned. While a portion of the kernel remains pinned, many regions are pageable and are only pinned while being accessed.

The advantage of having portions of memory pinned is that, when accessing a page that is pinned, you can retrieve the page without going through the page replacement algorithm. An adverse side effect of having too many pinned memory pages is that it can increase paging activity for unpinned pages, which would degrade performance.

The vmo maxpin% tunable can be used to adjust the amount of memory that can be pinned. The maxpin% tunable specifies the maximum percentage of real memory that can be pinned.

Note: Because the kernel must be able to pin some amount of kernel data, decreasing the value of the maxpin% tunable might lead to functional problems and is not advised.

User applications may pin memory through several different mechanisms. Applications can use the plock(), mlock(), and mlockall() subroutines to pin application memory.

An application can explicitly pin shared memory regions by specifying the SHM_LOCK option to the shmctl() subroutine. An application can also pin a shared memory region by specifying the SHM_PIN flag to shmget().