Check out my first novel, midnight's simulacra!

Pages: Difference between revisions

From dankwiki
No edit summary
Line 3: Line 3:


==Huge Pages==
==Huge Pages==
Making pages larger means fewer TLB misses for a given TLB size (due to more pages being supportable in the same amount of memory, due to narrower page identifiers), large mapping/releasing operations will be faster (due to fewer page table entries needing to be handled), and less memory is devoted to page table entries for a given amount of memory being indexed. The downside is possible wastage of main memory (due to pages not being used as completely). A 2002 paper from Navarro et al at Rice proposed transparent operating system support: "[http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.3.2392 Transparent Operating System Support for Superpages]". FreeBSD and Solaris ("[http://www.sun.com/blueprints/0304/817-5917.pdf support large pages transparently, while applications must explicitly take advantage of them on Linux (through at least 2.6.30).
Making pages larger means fewer TLB misses for a given TLB size (due to more pages being supportable in the same amount of memory, due to narrower page identifiers), large mapping/releasing operations will be faster (due to fewer page table entries needing to be handled), and less memory is devoted to page table entries for a given amount of memory being indexed. The downside is possible wastage of main memory (due to pages not being used as completely). A 2002 paper from Navarro et al at Rice proposed transparent operating system support: "[http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.3.2392 Transparent Operating System Support for Superpages]". Applications must generally be modified or wrapped to take advantage of large pages, for instance on Linux (through at least 2.6.30) and Solaris (through at least Solaris 9).
===Linux===
===Linux===
* They were a [http://lwn.net/Articles/40840/ 2003 Kernel Summit] topic, after seeing first [http://kerneltrap.org/node/418 introduction] in Linux 2.5.36 ([http://linuxgazette.net/155/krishnakumar.html LinuxGazette] primer article)
* They were a [http://lwn.net/Articles/40840/ 2003 Kernel Summit] topic, after seeing first [http://kerneltrap.org/node/418 introduction] in Linux 2.5.36 ([http://linuxgazette.net/155/krishnakumar.html LinuxGazette] primer article)
Line 10: Line 10:
* [http://www.mjmwired.net/kernel/Documentation/vm/hugetlbpage.txt hugetlbfs] and assorted infrastructure replaced these. Mel Gorman's [http://linux-mm.org/HugePages Linux MM wiki] has a good page on hugetlbfs.
* [http://www.mjmwired.net/kernel/Documentation/vm/hugetlbpage.txt hugetlbfs] and assorted infrastructure replaced these. Mel Gorman's [http://linux-mm.org/HugePages Linux MM wiki] has a good page on hugetlbfs.
* Val Henson wrote a good 2006 [http://lwn.net/Articles/188056/ KHB article] in LWN on transparent largepage support
* Val Henson wrote a good 2006 [http://lwn.net/Articles/188056/ KHB article] in LWN on transparent largepage support
===Solaris===
* Essential paper: "[http://www.sun.com/blueprints/0304/817-5917.pdf Supporting Multiple Page Sizes in the Solaris Operating System]" (March 2004)
* Solaris 2.6 through Solaris 8 offered "intimate shared memory" (ISM) based of 4M pages, requested via <tt>shmat(2)</tt> with the SHM_SHARE_MMU flag
* Solaris 9 supported a variety of page sizes and introduced <tt>memcntl(2)</tt> to configure page sizes on a per-map basis
** The <tt>ppgsz(1)</tt> wrapper amd <tt>libmpss.so</tt> libraries allow configuration of heap/stack pagesizes on a per-app-instance basis
===Applications===
===Applications===
* MySQL can use hugetlbfs via the <tt>large-pages</tt> option
* MySQL can use hugetlbfs via the <tt>large-pages</tt> option

Revision as of 14:26, 19 June 2009

Hardware

  • PAE, page tables, PTEs, TLB, MMU -- explain FIXME

Huge Pages

Making pages larger means fewer TLB misses for a given TLB size (due to more pages being supportable in the same amount of memory, due to narrower page identifiers), large mapping/releasing operations will be faster (due to fewer page table entries needing to be handled), and less memory is devoted to page table entries for a given amount of memory being indexed. The downside is possible wastage of main memory (due to pages not being used as completely). A 2002 paper from Navarro et al at Rice proposed transparent operating system support: "Transparent Operating System Support for Superpages". Applications must generally be modified or wrapped to take advantage of large pages, for instance on Linux (through at least 2.6.30) and Solaris (through at least Solaris 9).

Linux

  • They were a 2003 Kernel Summit topic, after seeing first introduction in Linux 2.5.36 (LinuxGazette primer article)
  • Rohit Seth provided the first explicit large page support to applications as covered in this LWN article
    • alloc_hugepages, free_hugepages, get_large_pages(2) and shared_large_pages(2) were present in kernels 2.5.36-2.5.54
  • hugetlbfs and assorted infrastructure replaced these. Mel Gorman's Linux MM wiki has a good page on hugetlbfs.
  • Val Henson wrote a good 2006 KHB article in LWN on transparent largepage support

Solaris

  • Essential paper: "Supporting Multiple Page Sizes in the Solaris Operating System" (March 2004)
  • Solaris 2.6 through Solaris 8 offered "intimate shared memory" (ISM) based of 4M pages, requested via shmat(2) with the SHM_SHARE_MMU flag
  • Solaris 9 supported a variety of page sizes and introduced memcntl(2) to configure page sizes on a per-map basis
    • The ppgsz(1) wrapper amd libmpss.so libraries allow configuration of heap/stack pagesizes on a per-app-instance basis

Applications

  • MySQL can use hugetlbfs via the large-pages option
  • kvm can use hugetlbfs with the --mem-path option since kvm-62, released in late 2008

Page Clustering

Page clustering (implemented by William Lee Irwin for Linux in 2003, and not to be confused with page-granularity swap-out clustering). There's good coverage in this KernelTrap article. This is essentially huge pages without hardware support, and therefore with some overhead and no improvements in TLB-relative performance. It was written up in Irwin's 2003 OLS paper, "A 2.5 Page Clustering Implementation".