[GH-ISSUE #1412] Windows: SeLockMemoryPrivilege moves the expert arena to 2 MiB large pages — but the token is issued at logon (1314 ≠ 1450) #573

Closed
opened 2026-11-04 01:44:09 +07:00 by bsakaguchi · 2 comments
Owner

Originally created by @shahrokhzargarpour on GitHub (Oct 7, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/1412

What changes

On Windows, if the account running the engine holds the "Lock pages in memory" user right
(SeLockMemoryPrivilege), Strata backs the expert arena with 2 MiB large pages instead of 4 KB pages.
Two things change in the startup log:

  1. The large pages refused … warning disappears and becomes a positive line.
  2. The working-set minimum + VirtualLock line for the (~46,700 MiB) arena disappears — large pages are
    non-pageable by construction, so the engine no longer needs to pin the working set to keep the arena resident.

This is an observation of startup-log behavior (allocator / working-set), not a throughput A/B.

Environment (where this was observed)

  • Engine: Strata v0.1.40.1 (82f46a8c), Windows 11, WDDM driver model.
  • GPUs: RTX 4080 SUPER 16 GB + RTX 3090 24 GB, layer split, expert weights in system RAM.
  • Model: Qwen3.8-Flash-Next UD-IQ4_XS (MoE), --expert-cache auto.
  • Flags: --batch 4 --batch-mtp --spec 4, KV int8 with --kv-resident 98304,
    --remote-expert-opt --pcie-frac 0.55 --pool-workers 8.

How to enable it (step by step)

  1. Grant Local Policies → User Rights Assignment → "Lock pages in memory" (SeLockMemoryPrivilege) to
    the account that runs the engine (via secpol.msc or your provisioning tool). It is a user right, not
    an "elevated process" privilege — the engine process does not need to run as administrator.
  2. Sign out and back in. The privilege is baked into the access token at logon; restarting the engine
    (or restarting the scheduled Task) is not enough. This was the part that cost the most time.
  3. Confirm the right is present in the account that will run the engine:
    whoami /priv
    
    SeLockMemoryPrivilege must be listed for that account.
  4. Start the engine as usual and read the arena line.

Evidence (verbatim startup lines)

Before (privilege not in the token) — the arena falls back to 4 KB pages:

large pages refused for 59523465216 B (GetLargePageMinimum=2097152, VirtualAlloc error 1314); using 4 KB pages

After (privilege present, fresh logon) — the arena is large-page backed:

expert arena: large pages are resident without a lock; … large pages (2097152 B)

and the ~46,700 MiB working-set minimum + VirtualLock line no longer appears.

1314 is not 1450

Two different failures show up as "large pages refused" and they need different fixes:

  • error 1314 = ERROR_PRIVILEGE_NOT_HELD: the account/token does not hold SeLockMemoryPrivilege.
    Fix: grant the right and re-logon (steps 1–2).
  • error 1450 = ERROR_NO_SYSTEM_RESOURCES: the privilege is fine, but the system cannot satisfy a
    contiguous large-page allocation — fragmentation. Observed here after killing and relaunching several
    engines in a row; a clean reboot made it succeed every time.

Not measured

The effect on tok/s / throughput was not measured. Both lines above are startup-log observations, not a
controlled comparison. No A/B was run. Do not read this as a performance claim.

Minimal repro

  1. Run once without the right → capture large pages refused … error 1314.
  2. Grant SeLockMemoryPrivilege to the account, sign out / sign in, verify whoami /priv.
  3. Run again with the same args → capture large pages are resident without a lock … large pages (2097152 B).
Originally created by @shahrokhzargarpour on GitHub (Oct 7, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/1412 ## What changes On Windows, if the account running the engine holds the **"Lock pages in memory"** user right (`SeLockMemoryPrivilege`), Strata backs the expert arena with **2 MiB large pages** instead of 4 KB pages. Two things change in the startup log: 1. The `large pages refused …` warning disappears and becomes a positive line. 2. The `working-set minimum + VirtualLock` line for the (~46,700 MiB) arena disappears — large pages are non-pageable by construction, so the engine no longer needs to pin the working set to keep the arena resident. This is an **observation of startup-log behavior** (allocator / working-set), not a throughput A/B. ## Environment (where this was observed) - Engine: Strata **v0.1.40.1** (`82f46a8c`), Windows 11, WDDM driver model. - GPUs: **RTX 4080 SUPER 16 GB + RTX 3090 24 GB**, layer split, expert weights in system RAM. - Model: Qwen3.8-Flash-Next **UD-IQ4_XS** (MoE), `--expert-cache auto`. - Flags: `--batch 4 --batch-mtp --spec 4`, KV int8 with `--kv-resident 98304`, `--remote-expert-opt --pcie-frac 0.55 --pool-workers 8`. ## How to enable it (step by step) 1. Grant **Local Policies → User Rights Assignment → "Lock pages in memory"** (`SeLockMemoryPrivilege`) to the account that runs the engine (via `secpol.msc` or your provisioning tool). It is a **user right**, not an "elevated process" privilege — the engine process does not need to run as administrator. 2. **Sign out and back in.** The privilege is baked into the access token **at logon**; restarting the engine (or restarting the scheduled Task) is **not enough**. This was the part that cost the most time. 3. Confirm the right is present in the account that will run the engine: ``` whoami /priv ``` `SeLockMemoryPrivilege` must be listed for that account. 4. Start the engine as usual and read the arena line. ## Evidence (verbatim startup lines) Before (privilege not in the token) — the arena falls back to 4 KB pages: ``` large pages refused for 59523465216 B (GetLargePageMinimum=2097152, VirtualAlloc error 1314); using 4 KB pages ``` After (privilege present, fresh logon) — the arena is large-page backed: ``` expert arena: large pages are resident without a lock; … large pages (2097152 B) ``` and the ~46,700 MiB `working-set minimum + VirtualLock` line no longer appears. ## 1314 is not 1450 Two different failures show up as "large pages refused" and they need different fixes: - **error 1314** = `ERROR_PRIVILEGE_NOT_HELD`: the account/token does not hold `SeLockMemoryPrivilege`. Fix: grant the right and **re-logon** (steps 1–2). - **error 1450** = `ERROR_NO_SYSTEM_RESOURCES`: the privilege is fine, but the system cannot satisfy a contiguous large-page allocation — fragmentation. Observed here after killing and relaunching several engines in a row; a **clean reboot** made it succeed every time. ## Not measured **The effect on tok/s / throughput was not measured.** Both lines above are startup-log observations, not a controlled comparison. No A/B was run. Do not read this as a performance claim. ## Minimal repro 1. Run once without the right → capture `large pages refused … error 1314`. 2. Grant `SeLockMemoryPrivilege` to the account, **sign out / sign in**, verify `whoami /priv`. 3. Run again with the same args → capture `large pages are resident without a lock … large pages (2097152 B)`.
Author
Owner

@midhatn commented on GitHub (Oct 7, 2026):

One scope detail worth adding: the resident-budget path is different from the full expert arena. In v0.1.40.3, FileExpertSource allocates the resident complement with cudaHostAlloc, so granting Lock pages in memory alone doesn't route that allocation through PinnedArena's explicit large-page path:

https://github.com/Niko1221/Strata/blob/v0.1.40.3/src/core/expert_source.cpp#L2264

On Windows 11 / Ryzen 9 7940HS / RTX 4070 Laptop 8 GB / 64 GB RAM, I tested an opt-in local prototype that reuses PinnedArena for the 36 GiB resident complement, accepts it only with large-page backing and successful CUDA mapped registration, and otherwise falls back to the existing allocator.

A standalone 36 GiB allocation and CUDA registration succeeded, with sampled page metadata confirming 2 MiB large pages. A later full-model run returned VirtualAlloc error 1450 and fell back to normal pinned RAM. The fallback passed the answer/tool/cache-restoration checks and clean engine unload. This is not a large-page inference speed result: the full-model run never obtained large-page backing.

This supports keeping 1314 and 1450 separate, and also checking which allocation path is actually active. I haven't established the exact cause of 1450 here. Windows needs contiguous physical space for each large page, not one physically contiguous 36 GiB region; fragmentation is a possible explanation, not something that error code alone proves.

https://learn.microsoft.com/en-us/windows/win32/memory/large-page-support

<!-- gh-comment-id:6045472971 --> @midhatn commented on GitHub (Oct 7, 2026): One scope detail worth adding: the resident-budget path is different from the full expert arena. In v0.1.40.3, `FileExpertSource` allocates the resident complement with `cudaHostAlloc`, so granting Lock pages in memory alone doesn't route that allocation through `PinnedArena`'s explicit large-page path: https://github.com/Niko1221/Strata/blob/v0.1.40.3/src/core/expert_source.cpp#L2264 On Windows 11 / Ryzen 9 7940HS / RTX 4070 Laptop 8 GB / 64 GB RAM, I tested an opt-in local prototype that reuses `PinnedArena` for the 36 GiB resident complement, accepts it only with large-page backing and successful CUDA mapped registration, and otherwise falls back to the existing allocator. A standalone 36 GiB allocation and CUDA registration succeeded, with sampled page metadata confirming 2 MiB large pages. A later full-model run returned VirtualAlloc error 1450 and fell back to normal pinned RAM. The fallback passed the answer/tool/cache-restoration checks and clean engine unload. This is not a large-page inference speed result: the full-model run never obtained large-page backing. This supports keeping 1314 and 1450 separate, and also checking which allocation path is actually active. I haven't established the exact cause of 1450 here. Windows needs contiguous physical space for each large page, not one physically contiguous 36 GiB region; fragmentation is a possible explanation, not something that error code alone proves. https://learn.microsoft.com/en-us/windows/win32/memory/large-page-support
Author
Owner

@Niko1221 commented on GitHub (Oct 8, 2026):

Thank you, that is accurate: Windows puts the privilege in the access token at logon, so granting "Lock pages in memory" takes effect only after the account logs off and on again (or the PC reboots). A line saying so is now in docs/DETAILS.md next to the Windows startup notes. And thanks to midhatn for the scope detail: the resident complement is allocated with cudaHostAlloc, which does not take the explicit large-page path, so the 2 MiB pages cover the expert arena and not every pinned buffer.

<!-- gh-comment-id:6059692982 --> @Niko1221 commented on GitHub (Oct 8, 2026): Thank you, that is accurate: Windows puts the privilege in the access token at logon, so granting "Lock pages in memory" takes effect only after the account logs off and on again (or the PC reboots). A line saying so is now in docs/DETAILS.md next to the Windows startup notes. And thanks to midhatn for the scope detail: the resident complement is allocated with cudaHostAlloc, which does not take the explicit large-page path, so the 2 MiB pages cover the expert arena and not every pinned buffer.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#573
No description provided.