HugePages on Linux

HugePages is a feature integrated into the Linux Kernel with release 2.6.  It provides alternative to 4K page size providing bigger pages.  In other words, it's a method to have large pages where it is useful for working with very large memory.  It's both useful in 32- and 64 bit configurations

Page Table:  Is the data structure of a virtual memory system in OS that mapps between virtual addresses and physical addresses. 
TLB = Translation Lookaside Buffer is a fixed size buffer or cache in a CPU that contains part of the page table to do virual address transalation faster.
hugetlb:  An entry in the TLB that points to a HugePage (larger than regular 4K). HugePage is handled by hugetlb.
hugetlbfs:  Is a new in-memory file system type.  Pages allocated on hugetlbfs are allocated in HugePages.

HugePages and oracle 11g AMM are not compatible.  If you use HugePages, both MEMORY_TARGET / MEMORY_MAX_TARGET parameters are unset.  With AMM all SGA memory is allocated by creating files under /dev/shm.  ramfs (instead of tmpfs mount over /dev/shm) is not supported for AMM at all.  With AMM Oracle needs to grow and reduce the size of SGA dynamically and this is not possible with ramfs.  Below are some facts about Huge Pages and its advantages

  • HugePages can be allocated on-the-fly but they must be reserved during system startup.
  • HugePage sizes from 2MB to 256MB based on kernel version and HW architecture
  • HugePages are not subject to reservation / release after the system startup unless there is system administrator intevention, basically changing the hugepages configuration (i.e. number of pages available or pool size)
  • Larger Page Size and Less # of Pages: Default page size is 4K whereas the HugeTLB size is 2048K. That means the system would need to handle 512 times less pages
  • No Page Table Lookups: Since the HugePages are not subject to replacement (despite regular pages), page table lookups are not required.
  • No Swapping: We must avoid swapping to happen on Linux OS at all
  • No 'kswapd' Operations: kswapd will get very busy if there is a very large area to be paged (i.e. 13 million page table entries for 50GB memory) and will use an incredible amount of CPU resource. When HugePages are used, kswapd is not involved in managing them.
     grep Hugepagesize /proc/meminfo

No comments:

Post a Comment