mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #42] [MERGED] pinned: MEM_LARGE_PAGES on Windows never worked - enable the privilege, round the size #2427
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#2427
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/42
Author: @pipeob0
Created: 9/28/2026
Status: ✅ Merged
Merged: 9/28/2026
Merged by: @Niko1221
Base:
main← Head:gh/large-pages📝 Commits (2)
0bf3216pinned: enable SeLockMemoryPrivilege and round the arena to GetLargePageMinimumfb1fb57pinned: say how many bytes were refused, and stop blaming the privilege📊 Changes
1 file changed (+31 additions, -5 deletions)
View changed files
📝
src/core/pinned.cu(+31 -5)📄 Description
Why
The pinned expert arena asks for
MEM_LARGE_PAGESbut on Windows it could never get them, for twoindependent reasons, and the log blamed a privilege the user had often already granted.
1. The privilege is never enabled in the process token. Having Lock pages in memory assigned to the
account is not enough —
VirtualAllocreturnsERROR_PRIVILEGE_NOT_HELD(1314) unless the process callsAdjustTokenPrivilegesfor itself first. The code only had a comment about the privilege. This is what madethe message misleading: granting the privilege, rebooting, and starting the engine printed the same
"needs SeLockMemoryPrivilege" line, because a different reason was now the blocker.
2. The size was passed unrounded.
VirtualAllocwithMEM_LARGE_PAGESrequires a size that is an exactmultiple of
GetLargePageMinimum(2 MiB). The arena size is not, so the call failed withERROR_INVALID_PARAMETER(87) — a parameter error that reads exactly like the privilege problem in the log.Rounded up: the slack is under 2 MiB and the tail is never touched.
Both fixed, on a desktop account with the privilege granted:
The refusal note now distinguishes three different failures
1450(ERROR_NO_SYSTEM_RESOURCES: the large-page pool does not have that many 2 MiB pages free rightnow),
87(size not a multiple) and1314(the privilege really is off) all printed one identical line.Seen for real while A/B-ing this: a run started minutes after an engine process was killed printed 1450, and
the next run succeeded — the killed process had not released its pinned pages yet. Note that this is a
state symptom (a dying engine still holding pinned memory) reported as a privilege problem, which is the
kind of thing worth being able to tell apart when reading a stall report (#31).
The second commit adds the requested byte count and stops asserting the cause.
Testing
STRATA_NO_LARGEPAGES=1skips the attempt entirely, so the same boot can be A/B'd.swift-iq3_xxspack, medians of interleaved runs:neutral here (48.8 ms/round without, 49.7 with). Reported as such: the reason to land this is that the
arena ends up being what the code says it is, and that the log tells the truth. Boxes with a much bigger
arena, or a heavier expert pool, have more TLB pressure to save than this one.
No ABI or behaviour change for anyone who cannot get large pages: same 4 KiB fallback as before.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.