Commit Graph

2 Commits

Author SHA1 Message Date
77ecad8b58 tracking: the hot/cold policy as the page mirror's tracking (HotColdTracking), and a probe observed after its arming (RT-TRACKING-POLICY)
HotColdTracking (src/title_mirror_hot_cold.h) implements TitleMirrorTracking (watch, unwatch, collect) over the
geometry watch's cells with TitleWritePolicy, so it can replace GuardTracking with no change in the mirror:
collect() returns the pages written since the last collect, each armed again first, and every time the pages
written so often that they are left writable. One collect is one interval of the policy's history.

A hot page's probe is now armed at the collect after it is asked for and judged on the interval after that;
judged on the interval of the arming itself, a page written every interval looked quiet and was turned cold
(seven promotions and six demotions of one page in 200 intervals). Test title_mirror_hot_cold (Windows, real
guards and a handler that does what the layer's does first): the page written every interval stops faulting
(12 faults in 200 intervals, the warm-up and the probes), the page written every 10th faults 19 times, and the
copy the collects name equals the memory after every collect.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 05:06:38 -05:00
61e9ed4c16 tracking: what a guard costs under Wine, a hot/cold write policy, and cells reopened in one call (RT-TRACKING-POLICY)
guard_fault_bench (Windows, prints a table): VirtualProtect per call and per page from 4 KiB to 4 MiB, one write
fault through a minimal handler and through the geometry watch's cells on one thread and on eight, re-arming a
tile, GetWriteWatch on private memory and on a section view, and Linux's soft-dirty bits through Z:\proc\self.
Under Wine on this machine: a fault 2-2.5 us, a tile re-armed 3 us, VirtualProtect 1.3 us for 4 KiB and 8 us for
4 MiB in one call against about 1 us a page one call at a time; GetWriteWatch works on private memory (37 of 37
pages) and not on a section view (error 87, as on Windows); soft-dirty bits read back clear (not usable here).

The geometry watch's cells reopened a faulted tile page by page, a VirtualQuery and a VirtualProtect each (16 us
a fault): reopen() now does one query and one protect per region of equal protection (5.3 us; 5.8 us of wall
time a fault with eight threads faulting, from 24).

TitleWritePolicy (src/title_write_policy.h, portable): pages written in most intervals are left writable and
copied at every collect, the others guarded and copied once a write faults; a page is armed before it is named,
so a write during the copy is in the next collect; hot pages are probed (guarded for one interval) every 32. Test
title_write_policy: scripted (hot stops faulting, cold faults once an interval, a quiet hot page turns cold) and
randomised against a byte-exact reference, writes during the copy and refused guards included.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 05:03:32 -05:00