Pre-set ACCESSED and DIRTY flags in page table entries#1067
Conversation
Mirrors the Linux kernel's _KERNPG_TABLE convention (_PAGE_PRESENT | _PAGE_RW | _PAGE_ACCESSED | _PAGE_DIRTY) for entries that point at another page table (PML4E, non-huge PDPTE, non-huge PDE). Pre-setting Accessed/Dirty avoids the CPU needing an atomic read-modify-write on the entry the first time it's walked, reducing cache-coherency traffic on the page-table walk path. Addresses microsoft#980, following up on a review comment from ziqiaozhou on PR microsoft#972 that suggested this optimization. Fixes 5 call sites that construct parent/intermediate table-pointer flags: three in litebox_platform_lvbs's map_phys_frame_range, map_non_contiguous_phys_frames, and page-fault handler; one in litebox_platform_linux_kernel's page-fault handler; and the raw PTE_TABLE_FLAGS constant used for manual PML4/PDPT/PDE writes during litebox_runner_lvbs's early boot trampoline mapping. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016L8VyzZRY6AgtSd3EWAxQa
Pre-set ACCESSED and DIRTY flags in page table entries
CvvT
left a comment
There was a problem hiding this comment.
Hi @dywongcloud Thanks for breaking down your previous PR. This one look reasonable to me. One minor concern is the long PR message that is unnecessary and makes git log harder to read. I would appreciate it if you could shorten it. For this PR, only keeping the text from summary should be fine. We would like to keep a consistent style. Thanks!
Hi I shortened it! Please let me know! |
|
sorry i accidentally closed it but I reopened it |
Pre-set the ACCESSED and DIRTY flags when creating page table entries, matching Linux’s
_KERNPG_TABLEbehavior. This avoids atomic read-modify-write operations by the CPU page-table walker on first access.