Windows/2008

[스크랩] 2008 32비트 커널 메모리 최대(MAX) / 제한(Limit)

99iberty 2014. 4. 18. 15:47

http://laigo.kr/653

 

 

Windows Server 2008, Windows VISTA 32bit 운영체제의 Paged Pool, NonPaged Pool 리소스 사용을 제한하기 위해서 Registry 키 값을 통해 설정할 수 있습니다. 물론 이전 버전에서도 가능했습니다만 약간의 차이가 있습니다.

커널 어드레싱 동적 관리(Dynamic kernel addressing)를 지원함으로써 주소 공간 사이즈를 고정하지 않고 주소 공간에 여유가 있을 때, 동적으로 Paged Pool, NonPaged Pool 사이즈를 확장할 수 있다는 것이 이전 Windows Server 2003 에서 정해진 커널 메모리 영역에 따른 시스템 리소스 부족 현상에 대해서 조금 더 유연하게 대처할 수 있는 기능입니다.



[환경]
Windows Server 2008 SP1
Physical Memory : 2GB (Hyper-V, Guest OS)


[시나리오]
Memory Management 설정을 변경하는 아래 레지스트리 경로에서 PagedPoolLimit, NonPagedPoolLimit 설정 후 시스템을 재시작 합니다.

HKEY_LOCAL_MACHINE\SYSTEM\Current Control Set\Control\Session Manager\Memory Management

1. REG_DWORD - NonPagedPoolLimit : 360 (Decimal)
2. REG_DWORD - PagedPoolLimit : 900 (Decimal)


(단위 : MB)





[확인방법]
1. Process Explorer 를 사용하여 Paged Pool, NonPaged, Pool Limit 을 확인합니다. Limit 을 적용했던 값은 나타나지 않고 각각 2GB, 1.5GB 값이 나타납니다. 실제 사용 가능한 최대 값이 아니라는 것입니다.



2. NotMyFault 툴을 사용하여 NonPaged Pool Leak 을 일부러 일으켜 360MB 부근에 도달하면 Pool allocation failed 가 발생하며 결국 system hang 이 발생하는 것을 확인할 수 있었습니다.


3. Debug Mode 로 부팅하여 Windbg 로 로컬 커널 디버그를 연결하여 현재 문제 발생 시점의 가상 메모리 값을 확인합니다.

lkd> vertarget
Windows Server 2008/Windows Vista Kernel Version 6001 (Service Pack 1) MP (1 procs) Free x86 compatible
Product: Server, suite: Enterprise TerminalServer SingleUserTS
Built by: 6001.18000.x86fre.longhorn_rtm.080118-1840
Machine Name:
Kernel base = 0x8161a000 PsLoadedModuleList = 0x81731c70
Debug session time: Mon Apr 25 22:33:17.123 2011 (GMT+9)
System Uptime: 0 days 0:25:45.031

lkd> !vm 21

*** Virtual Memory Usage ***
Physical Memory: 523988 ( 2095952 Kb)
Page File: \??\C:\pagefile.sys
Current: 2403152 Kb Free Space: 2403148 Kb
Minimum: 2403152 Kb Maximum: 6287856 Kb
Available Pages: 364889 ( 1459556 Kb)
ResAvail Pages: 415301 ( 1661204 Kb)
Locked IO Pages: 0 ( 0 Kb)
Free System PTEs: 381636 ( 1526544 Kb)
Modified Pages: 3411 ( 13644 Kb)
Modified PF Pages: 3411 ( 13644 Kb)
NonPagedPool Usage: 92117 ( 368468 Kb)
NonPagedPool Max: 389108 ( 1556432 Kb) // MmMaximumNonPagedPoolInBytes
PagedPool 0 Usage: 3928 ( 15712 Kb)
PagedPool 1 Usage: 2375 ( 9500 Kb)
PagedPool 2 Usage: 152 ( 608 Kb)
PagedPool 3 Usage: 214 ( 856 Kb)
PagedPool 4 Usage: 192 ( 768 Kb)
PagedPool Usage: 6861 ( 27444 Kb)
PagedPool Maximum: 523264 ( 2093056 Kb) // MmMaximumPagedPoolInBytes

********** 4236 pool allocations have failed ********** // Paged Pool Limit 에 도달한 이후 추가 요청에 대한 실패

Session Commit: 4416 ( 17664 Kb)
Shared Commit: 7283 ( 29132 Kb)
Special Pool: 0 ( 0 Kb)
Shared Process: 1596 ( 6384 Kb)
PagedPool Commit: 6877 ( 27508 Kb)
Driver Commit: 1883 ( 7532 Kb)
Committed pages: 150894 ( 603576 Kb)
Commit limit: 1108659 ( 4434636 Kb)


VA Type CurrentUse Peak Limit Failures
Unused 1484 Mb 0 Mb OPEN 0
SessionSpace 28 Mb 32 Mb OPEN 0
ProcessSpace 16 Mb 0 Mb OPEN 0
BootLoaded 28 Mb 0 Mb OPEN 0
PfnDatabase 14 Mb 76 Mb OPEN 0
NonPagedPool 360 Mb 360 Mb 360 Mb 18804 // MmNonPagedPoolLimit
PagedPool 32 Mb 44 Mb 900 Mb 0 // MmPagedPoolLimit
SpecialPool 0 Mb 0 Mb OPEN 0
SystemCache 28 Mb 150 Mb OPEN 0
SystemPtes 24 Mb 28 Mb OPEN 0
Hal 4 Mb 0 Mb OPEN 0
SessionGlobal 12 Mb 12 Mb OPEN 0
NonPagedSpecialPool 18 Mb 0 Mb OPEN 0
Driver Images 0 Mb 0 Mb OPEN 0

Maximum contiguous unused VA: 972 Mb


Max 값과 Limit 의 차이를 혼동하지 말고 Windows Server 2008 에서는 디버그 모드로 부팅하지 않는 한 커널 디버깅을 할 수 없으니 커널 메모리 이슈 발생 시, Registry 값도 같이 확인해야 할 것 같습니다.


[참고자료]
Memory Management Registry Keys


작성자 : Lai Go / 작성일자 : 2011.04.25