Maystyle :
Admin : New post
Guestbook
Local
media
Catergories
Recent Articles
Recent Comments
Recent Trackbacks
Calendar
Tag
Archive
Link
Search
 
  Lock Pages in Memory 
작성일시 : 2011. 8. 8. 21:58 | 분류 : Windows Server/Kernel

오랫만에 글을 올리는군요… : )

목적 : Page Size와 Lock Pages in Memory
(작은 머리가 폭발할 지경 / 어떤 문서는 Page Size무슨 4M니 2M이야기 해서 그냥 AMD 문서로 통일함)

Large Page Size는 x64 CPU인 Westmere 부터는 1G까지 지원됩니다. 하지만 AMD의 문서를 보니 보통 2M씩 쓰는게 일반적이라고 합니다. (http://blogs.amd.com/developer/2009/02/23/huge-pages-and-numa-on-windows-operating-systems/)

하지만 실제로 Page Size가 2M증가하는 것은 아니고 4K짜리 512개를 모아서 2M것처럼 할당을 해주는거라고 합니다. 그래서 TLB에서만 이 효과를 볼 수 있다는 말인건지… 좀 햇갈립니다.

The JVM or other application makes a VirtualAlloc request to allocate a chunk of memory with a flag to map it to huge pages.  The OS really deals in terms of 4K pages.  To return a 2MB page it must find 512 contiguous 4K pages and those will then be locked in memory (they are not candidates for paging out).  By default, it will look for such a 2MB block in the memory that is local to the requesting processor.  If the OS cannot find a free 2MB page in local memory, it will search in memory from other nodes in the system.

아무튼 위와 같기 때문에 이 설정이 Lock Pages in Memory였던 거군요…
어쨌든 W2k8에서는 기본으로 지원한다는것은 사실이고, 가장 큰 장점은 TLB 를 자알 쓸 수 있다 입니다. (성능차이는 약 20% 정도라고 함)

· Windows Server 2008/2008 R2 have Large Memory Pages enabled by default
· Windows Vista/7 have Large Memory Pages enabled by default
· Windows Server 2008 R2 Hyper-V added support for Large Memory Pages (surprise!) and is one of many new performance improvements in R2

(예를 들어 1M의 메모리를 할당하는 Application이 해당 메모리를 자주쓰는 경우 TLB는 256개가 필요합니다. 하지만 2M짜리 Page Size를 이용하는 경우1~ 2번이면 가능하겠죠….)

Large Page사용함으로 얻는 이익 : http://developer.amd.com/documentation/articles/Pages/2142006111.aspx
(주로 TLB와 관련된 성능 향상을 이야기 하고 있음)

JVM 이 Large Page Size사용하는 방법 : http://developer.amd.com/documentation/Articles/Pages/322006145.aspx

(Lock Pages in memory 정책을 통한 설정에 추가적으로 튜닝 포인트를 언급)
마지막으로 개발할때 고려사항은http://msdn.microsoft.com/en-us/library/aa366720(VS.85).aspx 을 참고하시면 될꺼 같습니다.

|