Windows Kernel Internals Advance Virtual Memory David B
Windows Kernel Internals Advance Virtual Memory *David B. Probert, Ph. D. Windows Kernel Development Microsoft Corporation © Microsoft Corporation 1
PFN: Working Set Page © Microsoft Corporation 3
PFN: Free Page © Microsoft Corporation 4
PFN: Standby Page © Microsoft Corporation 5
PFN: Transition page © Microsoft Corporation 6
PFN Fields Pte. Address: VA of PTE referencing page Ref. Count: count of WS or IO locks Original. Pte: PTE to restore on soft-fault Pte. Frame: Page. Frame for Pte. Address Flags: Modified : 1 Read. In. Progress : 1 Write. In. Progress : 1 Prototype. Pte: 1 Page. Color : 4 Page. Location : 3 Removal. Requested : 1 Cache. Attribute : 2 © Microsoft Corporation 7
Page Table Entries • Some fields defined by hardware • Six PTE states: – Active/valid – Transition – Modified-no-write – Demand zero – Page file – Mapped file © Microsoft Corporation 8
Valid x 86 Hardware PTEs Reserved Global Dirty Accessed Cache disabled Write through Owner Write Pageframe 31 R R R G R D A Cd Wt O W 1 12 11 10 9 8 7 6 5 4 3 © Microsoft Corporation 2 1 0 9
x 86 Invalid PTEs Transition Prototype Page file offset 0 31 Protection 5 4 12 11 10 9 31 0 Transition Prototype Transition Page file offset 1 PFN Protection 12 11 10 9 Cache disable Write through Owner © Microsoft Corporation Write HW ctrl 0 5 4 1 0 10
x 86 Invalid PTEs Demand zero: Page file PTE with zero offset and PFN Unknown: PTE is completely zero or Page Table doesn’t exist yet. Examine VADs. Pointer to Prototype PTE p. Pte bits 7 -27 31 p. Pte bits 0 -6 12 11 10 9 8 7 © Microsoft Corporation 5 4 0 11
MMPAGING_FILE • PFN_NUMBER Size, Max. Size, Min. Size, Free. Space, Curr. Usage, Peek. Usage, Highest. Page • p. File. Object • Mod. Writer. Mdl. Entries[] • p. Page. File. Name • p. Allocation. Bitmap • Flags: – Page. File. Number, Ref. Count, Boot. Part © Microsoft Corporation 12
MMSUPPORT // embedded in EPROCESS • Working. Set. Exp. Entry[2] • Last. Trim. Time • Flags • Page. Fault. Count, Peak. Working. Set. Size, Growth. Since. Last. Estimate • Minimum. Working. Set. Size, Maximum. Working. Set. Size • p. Vm. Working. Set. List • WSLE_NUMBER Claim, Next. Estimation. Slot, Next. Aging. Slot, Estimated. Available, Working. Set. Size © Microsoft Corporation 13
MMADDRESS_NODE • p. Parent, p. Left, p. Right • Starting. Vpn, Ending. Vpn © Microsoft Corporation 14
MMVAD • • • MMADDRESS_NODE Address. Tree. Node p. Control. Area p. First. Proto. Pte p. Last. Contig. Pte Flags: – Commit. Charge, Phys. Map, Image. Map, Awe, Prot, Mem. Commit, Private, Large. Pages, Write. Watch, No. Change, File. Offset 64 k, Sec. No. Change, Read. Only, Extendable, Inherit, Copy. On. Write © Microsoft Corporation 15
CONTROL_AREA • p. Segment • Dereference. List. Entry[2] • n. Sect. Refs, n. Pfn. Refs, n. Map. Views, n. Cache. Views, n. User. Refs • n. Mod. Writes, n. Flushes. Active, • Flags • p. File. Object • i. Pfn. Base • Subsections[] © Microsoft Corporation 16
SUBSECTION • p. Control. Area • Flags: – Read. Only, Read. Write, Subsection. Static, Global. Memory, Protection, Starting. Sector, Sector. End. Offset • • Starting. Sector n. Full. Sectors p. Subsect. Base. Ptes n. Unused. Ptes n. Ptes. In. Subsection p. Next. Subsection n. Mapped. Views © Microsoft Corporation 17
SECTION • • • MMADDRESS_NODE Address. Tree. Node p. Segment Size Initial. Page. Prot Flags: – Being. Deleted, Being. Created, Being. Purged, No. Modified. Writing, Fail. All. Io, Image, Based, File, Networked, No. Cache, Physical. Memory, Copy. On. Write, Commit, Floppy. Media, Was. Purged, User. Reference, Global. Memory, Delete. On. Close, File. Pointer. Null, Debug. Symbols. Loaded, Set. Mapped. File. Io. Complete, Collided. Flush, No. Change, Had. User. Reference, Image. Mapped. In. System. Space, User. Writable, Accessed, Global. Only. Per. Session, Rom © Microsoft Corporation 18
SEGMENT • • • p. Control. Area n. Ptes n. Writable. User. Refs Size Pte. Template n. Committed. Pages Flags Based. Address Prototype. Pte Proto. Ptes[] © Microsoft Corporation 19
Discussion © Microsoft Corporation 20
- Slides: 19