diff options
| author | Takoroka <137927095+Takoroka@users.noreply.github.com> | 2026-10-30 04:39:40 -0400 |
|---|---|---|
| committer | Takoroka <137927095+Takoroka@users.noreply.github.com> | 2026-10-30 04:40:24 -0400 |
| commit | f260bcb5a26a6b6b9675b41969a273858f024c55 (patch) | |
| tree | efbfa56ed06b1148caca6d4e1a21b56bed6ddde6 /src/video_core/buffer_cache/buffer_cache.cpp | |
| parent | 0218eacfd560d0ce48b3ffe64d279ee85bbf1347 (diff) | |
memory: skip clearing guest memory that is still zero
The kernel clears every page it hands out, and the backing memory is a
page-file section the host only gives RAM to once a page is touched. So
the clears themselves made every page of a game's heap resident: Mario
Kart World (12 GB layout) had a 12.5 GB working set 20 s after boot.
HostMemory keeps two bits per 64 KiB of backing: used (handed out by the
kernel at least once) and dirty (may hold data). Pages returned to the
kernel mark their granules dirty, and a zero clear only touches dirty
granules; a granule cleared in full is clean again. A new kernel on the
same memory marks everything a previous one used dirty, so leaked
processes can't leak data into the next game. KMemoryManager's
optimized-process fill and KSharedMemory's clear go through the same
path.
Mario Kart World, title screen and attract demo, 180 s: working set 20 s
in 4.7-6.4 GB instead of 12.5 GB, peak 14-17.6 GB instead of 20.1 GB.
Diffstat (limited to 'src/video_core/buffer_cache/buffer_cache.cpp')
0 files changed, 0 insertions, 0 deletions
