[GH-ISSUE #4671] [Engine] the PLE table lock is refused under systemd's default 8 MiB memlock: the residency policy admits it without checking RLIMIT_MEMLOCK #2127

Open
opened 2026-11-04 01:56:54 +07:00 by bsakaguchi · 2 comments
Owner

Originally created by @liaiwu on GitHub (Oct 30, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/4671

Problem

A systemd service that does not set LimitMEMLOCK runs with RLIMIT_MEMLOCK = 8 MiB. The 0.2.7 PLE residency
policy decides to lock the table from RAM figures alone, the kernel refuses the 26.8 GiB mlock(), and the
engine keeps serving normally with the table faulted in but reclaimable. Two start-up lines are the only sign;
nothing fails and nobody restarts.

Measured on this box, that state costs +6.0% of decode on one workload (six runs against six, Welch t=5.1)
and +2.6% on another, which the sample cannot separate. This is the default path: the start-up line has no
--ple-io at all, the policy picked ram on its own.

Environment

Strata 870aedd9 (v0.2.8), engine 0.1.54 (the binary's own --version). Ubuntu 24.04, kernel 6.8.0-52, one
RTX 4090 24 GB (sm_89), Intel i7-14700KF (AVX2), 125.6 GiB RAM, driver 580.178.04, built against CUDA 12.8.
Model Qwen3.8-Flash-Next, ISTA-DASLab GSQ-RCO IQ3_S. PLE table 26.8 GiB (320001536 rows), pinned expert
arena 46.84 GiB, MTP on.

The running engine's args (/proc/<pid>/cmdline, no --ple-io):

--serve --pack <data>/packs/iq3_s
--native <data>/models/iq3_s/Qwen3.8-Flash-Next-GSQ-RCO-IQ3_S-00001-of-00002.gguf
--ple-gguf <data>/models/iq3_s/Qwen3.8-Flash-Next-GSQ-RCO-IQ3_S-00002-of-00002.gguf
--expert-profile <repo>/data/expert-profile.bin
--expert-cache auto --prefill auto --spec 4 --spec-min-p 0.5 --mtp <data>/mtp/rt
--max-context 262144 --kv int8 --kv-resident 32768 --vram-reserve-mib 244 --pool-workers 13
--conversation-cache-mib 32768 --conversation-cache-slots 8

Started by a hand-written systemd unit (ExecStart -> run.sh -> serve/server.py), not by setup.py —
which is where the memlock limit would have been raised.

Reproduce

  1. Start with no LimitMEMLOCK and no drop-in. Read /proc/<pid>/limits:

    Max locked memory   8388608   8388608   bytes
    

    A login shell on the same machine reports 15.7 GiB, so starting the same command from a terminal does not
    reproduce it.

  2. The start-up log then shows:

    strata: PLE table mlock failed (Cannot allocate memory; raise `ulimit -l`): its pages stay faulted in but may be reclaimed
    strata generate: PLE table loaded (not locked) (--ple-io ram chosen by the residency policy) in 0.1 s
    

    /proc/<pid>/status shows VmLck: 0 kB, and /proc/meminfo shows Mlocked: 11104 kB (nothing of the table).

  3. Add a drop-in /etc/systemd/system/<unit>.service.d/memlock.conf containing [Service] and
    LimitMEMLOCK=infinity, then daemon-reload and restart. Nothing else changes — same unit, same config,
    same model files. The start-up line becomes:

    strata generate: PLE table locked in RAM (--ple-io ram chosen by the residency policy) in 1.1 s
    

    and VmLck is 28125136 kB, Mlocked 26.83 GiB — exactly the table.

Expected

Either the policy does not pick a locked table that this process cannot lock, or the refusal says what it is
worth. The policy's own arithmetic — ple_resident_admit (include/strata/core/ple_residency.hpp:23, called
at src/program/generate.cpp:4693) — compares table + expert arena + 8 GiB headroom against available RAM and
never reads RLIMIT_MEMLOCK, so it says yes and the kernel says no. The #4518 back-out
(ple_lock_blocks_cache, same header, line 43) then reasons about the lock as if it had succeeded.

What the refusal costs

Same machine, same unit, same config, same model; the arms alternate, and the only difference between an arm
pair is that drop-in. Two fixed request bodies (md5 pinned, fa6015c823765aab5426127c72819fac and
454bc519cca732a5d1a94b41e31923d0), three runs per arm, every request finish_reason: stop with non-null
content. predicted_per_second from the server's own timings. Decode tok/s:

workload locked, arm 1 locked, arm 2 unlocked, arm 1 unlocked, arm 2
A 141.3, 141.3, 144.7 140.2, 144.3, 147.1 133.0, 139.6, 136.3 130.9, 134.8, 134.6
B 163.7, 176.6, 177.0 163.4, 179.2, 174.1 154.9, 179.9, 170.7 156.6, 171.1, 173.3

Pooled, six runs per side:

workload locked unlocked delta (median) Welch t delta without the first run of each arm arm pairs (arm1, arm2)
A 142.8 (sd 2.6) 134.7 (sd 3.0) +6.0% 5.12 (df 9.9) +6.6% (t=4.8) +3.7%, +7.2%
B 175.4 (sd 7.0) 170.9 (sd 9.9) +2.6% 0.93 — not separable +2.7% (t=1.25) +3.5%, +1.8%
  • The locked side reproduces itself: arm 1 against arm 2 is -1.4% and +2.1%.
  • MTP acceptance does not move (A: 58.4-61.1%, B: 82.3-86.9% across all four arms), so this is decode
    throughput, not better speculation.
  • The first request of each arm is systematically the slowest one of that arm (its prompt_ms is ~960 ms
    against ~105 ms for the later ones), so the table also gives the figure with that run dropped; the direction
    is unchanged.
  • An earlier round of the same comparison, run a few hours earlier, showed +9.4% and +9.3%. It is not the
    number to use: that round's arms sat inside different amounts of conversation-cache activity (28 against 37
    park/restore log lines in the two start-ups), which the redo controlled by holding the cache configuration
    fixed and alternating the arms. Why it inflated the earlier figure is not established.

What the lock itself costs the host

Read in the same session, the same unit and config, only the drop-in different:

not locked locked
/proc/meminfo Mlocked / Unevictable 11 MiB / 11 MiB 26.83 GiB / 26.83 GiB
used (from free) 59.6 GiB 84.2 GiB
buff/cache 69.7 GiB 77.7 GiB
engine VmRSS / RssAnon / RssFile 81.7 / 51.7 / 26.1 GiB 80.4 / 49.5 / 27.1 GiB
engine VmSwap 0 0
swap in use 1.0766 GB 1.0798 GB

The engine's own footprint does not grow; 26.8 GiB moves from reclaimable file pages into unevictable ones.
The engine's own VmSwap stays 0 in both states, so any memory pressure from locking lands on other processes.

Two things I am not claiming here: MemAvailable read 66.0 GiB unlocked and 41.4 GiB locked, but the two
reads were not at the same point in the session's life, so the size of that change is not measured; and
swap in use barely moved between those two reads, although earlier in the day I saw it go from 6.7 MiB to
959 MiB after the lock was raised — that was under hours of load, and I did not identify what got swapped.

Suggested change — scope to be agreed, no patch offered

  • Read getrlimit(RLIMIT_MEMLOCK) into ple_resident_admit. When the limit is below the table, either keep
    the direct reads, or pick the mapped-but-unlocked table and say so, rather than admitting a lock that will
    be refused.
  • In the refusal line (src/kernels/ngram.cpp:461) state what the lock is worth, since the engine keeps
    serving and nothing else prompts a restart.

Say the word if either is unwanted and I will drop it.

Reproduction status

Reproduced locally on one machine: four alternating arms, six runs against six, and the state itself confirmed
by /proc/<pid>/limits, VmLck, Mlocked and the two start-up lines above.

Not verified / not run

  • The mechanism behind the decode gain is not verified. The guess is that decode consults the 26.8 GiB
    n-gram table per token and an unlocked table competes with the 46.84 GiB pinned arena for reclaimable RAM;
    I measured no page-fault or reclaim counters to support it.
  • Workload B's +2.6% is not separable at n=6 against n=6. That is a sample limit, not a measured zero.
  • The prompt-side timing is not attributed (prompt_ms per arm's first run is ~960 ms against ~105 ms later);
    no prompt-side figure is claimed.
  • Answer quality across arms was not compared; the arms differ in tokens/s only.
  • One machine, one model, one quantization. No Windows, no HIP, no second GPU. The engine here was built from
    the checkout, not the installer.
  • I did not re-run the 0.1.43.1 arm under the redo, so "the engine code between 0.1.43.1 and 0.1.54 changed
    decode by -0.3% / -0.5%" comes from the earlier, less controlled round and carries its caveat.
  • Raw per-request JSON (24 responses from the four arms) is on my machine and can be attached on request, as
    can the two request bodies and the small A/B script.
  • #4104 / #4105 (open PR) change how the table is read into RAM, and their Limits note says "setup sets"
    the memlock limit — that is the setup path, not a hand-written unit, and the PR is not in 0.1.54. This issue
    is about the admission decision, which both the old and the new shape make the same way.
  • #1211 (closed) measured --ple-io direct against --ple-io ram and found no gain. That is a different
    comparison: both of its arms had ulimit -l unlimited, and neither arm is "the table is in RAM but its lock
    was refused".
  • #4610 asks for memlock in the standard report; this is one case where the limit changes what a run means.
  • #3913 is the same class of problem on the HIP side, at a different call site.
  • #4518's back-out assumes the lock succeeded.

AI disclosure

Written with an AI assistant (Claude, Anthropic) working on my machine at my direction: it read the source and
my logs and drafted this text. The restarts, the runs and the numbers are mine; every line reference above was
checked against 870aedd9, and the log lines were copied from the engine log rather than retyped.

Originally created by @liaiwu on GitHub (Oct 30, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/4671 ## Problem A systemd service that does not set `LimitMEMLOCK` runs with `RLIMIT_MEMLOCK = 8 MiB`. The 0.2.7 PLE residency policy decides to lock the table from RAM figures alone, the kernel refuses the 26.8 GiB `mlock()`, and the engine keeps serving normally with the table faulted in but reclaimable. Two start-up lines are the only sign; nothing fails and nobody restarts. Measured on this box, that state costs **+6.0% of decode** on one workload (six runs against six, Welch t=5.1) and **+2.6%** on another, which the sample cannot separate. This is the default path: the start-up line has no `--ple-io` at all, the policy picked `ram` on its own. ## Environment Strata `870aedd9` (v0.2.8), engine `0.1.54` (the binary's own `--version`). Ubuntu 24.04, kernel 6.8.0-52, one RTX 4090 24 GB (sm_89), Intel i7-14700KF (AVX2), 125.6 GiB RAM, driver 580.178.04, built against CUDA 12.8. Model Qwen3.8-Flash-Next, ISTA-DASLab GSQ-RCO IQ3_S. PLE table 26.8 GiB (`320001536 rows`), pinned expert arena 46.84 GiB, MTP on. The running engine's `args` (`/proc/<pid>/cmdline`, no `--ple-io`): --serve --pack <data>/packs/iq3_s --native <data>/models/iq3_s/Qwen3.8-Flash-Next-GSQ-RCO-IQ3_S-00001-of-00002.gguf --ple-gguf <data>/models/iq3_s/Qwen3.8-Flash-Next-GSQ-RCO-IQ3_S-00002-of-00002.gguf --expert-profile <repo>/data/expert-profile.bin --expert-cache auto --prefill auto --spec 4 --spec-min-p 0.5 --mtp <data>/mtp/rt --max-context 262144 --kv int8 --kv-resident 32768 --vram-reserve-mib 244 --pool-workers 13 --conversation-cache-mib 32768 --conversation-cache-slots 8 Started by a hand-written systemd unit (`ExecStart` -> `run.sh` -> `serve/server.py`), not by `setup.py` — which is where the memlock limit would have been raised. ## Reproduce 1. Start with no `LimitMEMLOCK` and no drop-in. Read `/proc/<pid>/limits`: Max locked memory 8388608 8388608 bytes A login shell on the same machine reports 15.7 GiB, so starting the same command from a terminal does not reproduce it. 2. The start-up log then shows: strata: PLE table mlock failed (Cannot allocate memory; raise `ulimit -l`): its pages stay faulted in but may be reclaimed strata generate: PLE table loaded (not locked) (--ple-io ram chosen by the residency policy) in 0.1 s `/proc/<pid>/status` shows `VmLck: 0 kB`, and `/proc/meminfo` shows `Mlocked: 11104 kB` (nothing of the table). 3. Add a drop-in `/etc/systemd/system/<unit>.service.d/memlock.conf` containing `[Service]` and `LimitMEMLOCK=infinity`, then `daemon-reload` and `restart`. Nothing else changes — same unit, same config, same model files. The start-up line becomes: strata generate: PLE table locked in RAM (--ple-io ram chosen by the residency policy) in 1.1 s and `VmLck` is `28125136 kB`, `Mlocked` 26.83 GiB — exactly the table. ## Expected Either the policy does not pick a locked table that this process cannot lock, or the refusal says what it is worth. The policy's own arithmetic — `ple_resident_admit` (`include/strata/core/ple_residency.hpp:23`, called at `src/program/generate.cpp:4693`) — compares table + expert arena + 8 GiB headroom against available RAM and never reads `RLIMIT_MEMLOCK`, so it says yes and the kernel says no. The `#4518` back-out (`ple_lock_blocks_cache`, same header, line 43) then reasons about the lock as if it had succeeded. ## What the refusal costs Same machine, same unit, same config, same model; the arms alternate, and the only difference between an arm pair is that drop-in. Two fixed request bodies (md5 pinned, `fa6015c823765aab5426127c72819fac` and `454bc519cca732a5d1a94b41e31923d0`), three runs per arm, every request `finish_reason: stop` with non-null content. `predicted_per_second` from the server's own `timings`. Decode tok/s: | workload | locked, arm 1 | locked, arm 2 | unlocked, arm 1 | unlocked, arm 2 | |---|---|---|---|---| | A | 141.3, 141.3, 144.7 | 140.2, 144.3, 147.1 | 133.0, 139.6, 136.3 | 130.9, 134.8, 134.6 | | B | 163.7, 176.6, 177.0 | 163.4, 179.2, 174.1 | 154.9, 179.9, 170.7 | 156.6, 171.1, 173.3 | Pooled, six runs per side: | workload | locked | unlocked | delta (median) | Welch t | delta without the first run of each arm | arm pairs (arm1, arm2) | |---|---|---|---|---|---|---| | **A** | 142.8 (sd 2.6) | 134.7 (sd 3.0) | **+6.0%** | **5.12** (df 9.9) | +6.6% (t=4.8) | +3.7%, +7.2% | | B | 175.4 (sd 7.0) | 170.9 (sd 9.9) | +2.6% | 0.93 — not separable | +2.7% (t=1.25) | +3.5%, +1.8% | - The locked side reproduces itself: arm 1 against arm 2 is -1.4% and +2.1%. - **MTP acceptance does not move** (A: 58.4-61.1%, B: 82.3-86.9% across all four arms), so this is decode throughput, not better speculation. - The first request of each arm is systematically the slowest one of that arm (its `prompt_ms` is ~960 ms against ~105 ms for the later ones), so the table also gives the figure with that run dropped; the direction is unchanged. - An earlier round of the same comparison, run a few hours earlier, showed +9.4% and +9.3%. It is **not** the number to use: that round's arms sat inside different amounts of conversation-cache activity (28 against 37 park/restore log lines in the two start-ups), which the redo controlled by holding the cache configuration fixed and alternating the arms. Why it inflated the earlier figure is not established. ## What the lock itself costs the host Read in the same session, the same unit and config, only the drop-in different: | | not locked | locked | |---|---|---| | `/proc/meminfo` `Mlocked` / `Unevictable` | 11 MiB / 11 MiB | 26.83 GiB / 26.83 GiB | | `used` (from `free`) | 59.6 GiB | 84.2 GiB | | `buff/cache` | 69.7 GiB | 77.7 GiB | | engine `VmRSS` / `RssAnon` / `RssFile` | 81.7 / 51.7 / 26.1 GiB | 80.4 / 49.5 / 27.1 GiB | | engine `VmSwap` | 0 | 0 | | swap in use | 1.0766 GB | 1.0798 GB | The engine's own footprint does not grow; 26.8 GiB moves from reclaimable file pages into unevictable ones. The engine's own `VmSwap` stays 0 in both states, so any memory pressure from locking lands on other processes. Two things I am **not** claiming here: `MemAvailable` read 66.0 GiB unlocked and 41.4 GiB locked, but the two reads were not at the same point in the session's life, so the size of that change is not measured; and swap in use barely moved between those two reads, although earlier in the day I saw it go from 6.7 MiB to 959 MiB after the lock was raised — that was under hours of load, and I did not identify what got swapped. ## Suggested change — scope to be agreed, no patch offered - Read `getrlimit(RLIMIT_MEMLOCK)` into `ple_resident_admit`. When the limit is below the table, either keep the direct reads, or pick the mapped-but-unlocked table and say so, rather than admitting a lock that will be refused. - In the refusal line (`src/kernels/ngram.cpp:461`) state what the lock is worth, since the engine keeps serving and nothing else prompts a restart. Say the word if either is unwanted and I will drop it. ## Reproduction status Reproduced locally on one machine: four alternating arms, six runs against six, and the state itself confirmed by `/proc/<pid>/limits`, `VmLck`, `Mlocked` and the two start-up lines above. ## Not verified / not run - **The mechanism behind the decode gain is not verified.** The guess is that decode consults the 26.8 GiB n-gram table per token and an unlocked table competes with the 46.84 GiB pinned arena for reclaimable RAM; I measured no page-fault or reclaim counters to support it. - Workload B's +2.6% is not separable at n=6 against n=6. That is a sample limit, not a measured zero. - The prompt-side timing is not attributed (`prompt_ms` per arm's first run is ~960 ms against ~105 ms later); no prompt-side figure is claimed. - Answer quality across arms was not compared; the arms differ in tokens/s only. - One machine, one model, one quantization. No Windows, no HIP, no second GPU. The engine here was built from the checkout, not the installer. - I did not re-run the 0.1.43.1 arm under the redo, so "the engine code between 0.1.43.1 and 0.1.54 changed decode by -0.3% / -0.5%" comes from the earlier, less controlled round and carries its caveat. - Raw per-request JSON (24 responses from the four arms) is on my machine and can be attached on request, as can the two request bodies and the small A/B script. ## Related - #4104 / #4105 (open PR) change **how** the table is read into RAM, and their Limits note says "setup sets" the memlock limit — that is the setup path, not a hand-written unit, and the PR is not in 0.1.54. This issue is about the admission decision, which both the old and the new shape make the same way. - #1211 (closed) measured `--ple-io direct` against `--ple-io ram` and found no gain. That is a different comparison: both of its arms had `ulimit -l unlimited`, and neither arm is "the table is in RAM but its lock was refused". - #4610 asks for memlock in the standard report; this is one case where the limit changes what a run means. - #3913 is the same class of problem on the HIP side, at a different call site. - #4518's back-out assumes the lock succeeded. ## AI disclosure Written with an AI assistant (Claude, Anthropic) working on my machine at my direction: it read the source and my logs and drafted this text. The restarts, the runs and the numbers are mine; every line reference above was checked against `870aedd9`, and the log lines were copied from the engine log rather than retyped.
Author
Owner

@alexanderi96 commented on GitHub (Oct 31, 2026):

One arm that might be worth adding: --ple-io direct. It reads rows with O_DIRECT through a ~90 MB row cache, so the table costs neither locked memory nor page cache. #1211 measured direct against ram with both arms locked and found no gain for ram; if that still holds on your box, direct would give back the decode you measured without making 26.8 GiB unevictable. Data point, not a measurement: on a 64 GB host with a 32 GiB arena the residency policy picks direct on its own (table + arena + 8 GiB headroom does not fit).

<!-- gh-comment-id:6543065664 --> @alexanderi96 commented on GitHub (Oct 31, 2026): One arm that might be worth adding: `--ple-io direct`. It reads rows with `O_DIRECT` through a ~90 MB row cache, so the table costs neither locked memory nor page cache. #1211 measured direct against ram with both arms locked and found no gain for ram; if that still holds on your box, direct would give back the decode you measured without making 26.8 GiB unevictable. Data point, not a measurement: on a 64 GB host with a 32 GiB arena the residency policy picks direct on its own (table + arena + 8 GiB headroom does not fit).
Author
Owner

@liaiwu commented on GitHub (Nov 2, 2026):

Following up on @alexanderi96's suggestion: we ran the --ple-io direct arm on the 4090 box from #4671. Result on this machine is no consistent direction — neither the win nor the loss that was predicted.

What was changed (one thing at a time): the config's args got exactly two entries appended, "--ple-io", "direct". Every other argument is byte-identical (--vram-reserve-mib 244, --kv int8 --kv-resident 32768, --conversation-cache-mib 32768 --conversation-cache-slots 8, --pool-workers 13, --max-context 262144, --spec 4 --spec-min-p 0.5). Engine 0.1.54 (870aedd9), one RTX 4090 (23.988 GiB, sm_89), 125.6 GiB RAM, model Qwen3.8-Flash-Next GSQ-RCO IQ3_S, storage three Samsung 980 PRO 2TB in Linux RAID5 (/proc/mdstat: level 5, 32k chunk, [3/3][UUU]). The machine is dedicated to Strata.

@alexanderi96's mechanism claim is confirmed here. Read from the running process while direct was up:

  • Mlocked 11,104 kB and Unevictable 11,112 kB — against 26.83 GiB for both when the table was locked; the engine's own VmLck was 0 kB.
  • No mapping anywhere near 26.8 GiB. Largest mappings by RSS: 49,116,200 kB = 46.84 GiB anon (that is the cudaHostRegister expert arena) and 6,695,924 kB anon; the third largest is 329,800 kB.
  • grep -E "\.bin|\.gguf|ngram|ple" /proc/<pid>/maps returned nothing at all — the n-gram table is not mapped in the first place.

So the 26.8 GiB really is off the resident side, not relabelled. GPU side does not move: expert cache 8591 slots, 16.29 GiB (8594 slots / 16.30 GiB when locked). Startup probe: PLE direct read probe: 106371 rows/s (fine).

Decode, binned by prompt length — median tok/s with n; first request after each engine start dropped; only requests that generated ≥200 tokens. Same machine, same day, single engine start per arm (locked 09:41–10:36, direct from 10:36):

prompt direct ram + locked diff
20-40K 138.1 (3) 139.6 (16, from the previous day) -1.1%
40-80K 138.7 (11) 136.2 (13) +1.8%
80-120K 143.0 (18) 136.3 (18) +4.9%
120-160K 129.0 (11) 136.9 (27) -5.8%
220K+ 128.3 (16) 132.9 (1) not usable

Draft acceptance (median over all requests): 68.9% direct vs 69.2% locked. Prompt re-read cost: 222,424 read in 70,336 ms = 3,162 tok/s on direct vs 199,506 read in 63,767 ms = 3,129 tok/s on the locked arm (different prompt sizes, so treat as same shape, not as a pair).

Two adjacent bands land on opposite sides of zero, both just outside the +-4-5% run-to-run spread we measured on this box with repeated identical request bodies. Our reading: no consistent direction — session and context composition, not the ple-io mode.

This is an observation, not a controlled comparison. Unconfirmed as such: request bodies are whatever the live sessions issued (not md5-pinned, not the same prompts in each arm); one engine start per arm, so start-to-start drift is not controlled; n=3 in the 20-40K band; conversation-cache activity per arm was not designed into the comparison (counted afterwards: 49 parked/restored lines on the direct arm vs 45 on the locked arm).

Not run: a D L L D alternating-restart comparison with a pinned pair of request bodies, and a dedicated ~20K-token prompt body — which is exactly where @fioruccione saw direct lose (-3.2% decode, -4.4% prefill at 20K, non-overlapping ranges) and which we only covered through natural traffic. We also did not measure raw NVMe bandwidth, deliberately: pushing IO at a model file behind a serving backend risks stalling prefill.

Why we still went back to ram + locked — not because direct measured slower. At an indistinguishable speed range, locked is the side with a controlled comparison behind it (+6.0% over unlocked here, six vs six, Welch t=5.12; +0.2% on @fioruccione's box), it keeps PLE reads off the NVMe path entirely, and it is the configuration all of our baselines were measured on. Freeing 26.8 GiB bought nothing on this machine: MemAvailable was 60.1 GiB under direct vs 38.1 GiB locked, against a physical park gate that only refuses below 2.5 GiB available.

Where @alexanderi96's reasoning does hold: direct really is close to free on this box, because the disks are fast and PLE reads are pure reads, so RAID5's read-modify-write penalty never enters. A box with a spinning disk, or memory tight enough that the residency policy picks direct by itself, is a different case — and on such a box direct is also the only option that actually removes those 26.8 GiB from memory rather than moving them into the reclaimable column.

Read-only checks anyone can repeat while an engine is running:

awk '/MemAvailable|^Mlocked|Unevictable|^MemTotal/' /proc/meminfo
p=$(pgrep -f "build/strat[a]" | head -1); grep -E "VmLck|VmRSS" /proc/$p/status
pmap -x $p | sort -k3 -n | tail -15
grep -cE "\.bin|\.gguf|ngram|ple" /proc/$p/maps

Still unexplained on both machines: the mechanism behind the per-machine memlock difference.

<!-- gh-comment-id:6568342833 --> @liaiwu commented on GitHub (Nov 2, 2026): Following up on @alexanderi96's suggestion: we ran the `--ple-io direct` arm on the 4090 box from #4671. Result on this machine is **no consistent direction** — neither the win nor the loss that was predicted. **What was changed** (one thing at a time): the config's `args` got exactly two entries appended, `"--ple-io", "direct"`. Every other argument is byte-identical (`--vram-reserve-mib 244`, `--kv int8 --kv-resident 32768`, `--conversation-cache-mib 32768 --conversation-cache-slots 8`, `--pool-workers 13`, `--max-context 262144`, `--spec 4 --spec-min-p 0.5`). Engine 0.1.54 (`870aedd9`), one RTX 4090 (23.988 GiB, sm_89), 125.6 GiB RAM, model Qwen3.8-Flash-Next GSQ-RCO IQ3_S, storage three Samsung 980 PRO 2TB in Linux RAID5 (`/proc/mdstat`: level 5, 32k chunk, `[3/3][UUU]`). The machine is dedicated to Strata. **@alexanderi96's mechanism claim is confirmed here.** Read from the running process while direct was up: - `Mlocked` 11,104 kB and `Unevictable` 11,112 kB — against 26.83 GiB for both when the table was locked; the engine's own `VmLck` was 0 kB. - No mapping anywhere near 26.8 GiB. Largest mappings by RSS: `49,116,200 kB` = 46.84 GiB anon (that is the `cudaHostRegister` expert arena) and `6,695,924 kB` anon; the third largest is 329,800 kB. - `grep -E "\.bin|\.gguf|ngram|ple" /proc/<pid>/maps` returned nothing at all — the n-gram table is not mapped in the first place. So the 26.8 GiB really is off the resident side, not relabelled. GPU side does not move: `expert cache 8591 slots, 16.29 GiB` (8594 slots / 16.30 GiB when locked). Startup probe: `PLE direct read probe: 106371 rows/s (fine)`. **Decode, binned by prompt length** — median tok/s with n; first request after each engine start dropped; only requests that generated ≥200 tokens. Same machine, same day, single engine start per arm (locked 09:41–10:36, direct from 10:36): | prompt | `direct` | `ram` + locked | diff | |---|---|---|---| | 20-40K | 138.1 (3) | 139.6 (16, from the previous day) | -1.1% | | 40-80K | 138.7 (11) | 136.2 (13) | +1.8% | | 80-120K | 143.0 (18) | 136.3 (18) | +4.9% | | 120-160K | 129.0 (11) | 136.9 (27) | -5.8% | | 220K+ | 128.3 (16) | 132.9 (1) | not usable | Draft acceptance (median over all requests): 68.9% direct vs 69.2% locked. Prompt re-read cost: `222,424 read in 70,336 ms` = 3,162 tok/s on direct vs `199,506 read in 63,767 ms` = 3,129 tok/s on the locked arm (different prompt sizes, so treat as same shape, not as a pair). Two adjacent bands land on opposite sides of zero, both just outside the +-4-5% run-to-run spread we measured on this box with repeated identical request bodies. Our reading: **no consistent direction** — session and context composition, not the ple-io mode. **This is an observation, not a controlled comparison.** Unconfirmed as such: request bodies are whatever the live sessions issued (not md5-pinned, not the same prompts in each arm); one engine start per arm, so start-to-start drift is not controlled; n=3 in the 20-40K band; conversation-cache activity per arm was not designed into the comparison (counted afterwards: 49 parked/restored lines on the direct arm vs 45 on the locked arm). **Not run:** a `D L L D` alternating-restart comparison with a pinned pair of request bodies, and a dedicated ~20K-token prompt body — which is exactly where @fioruccione saw direct lose (-3.2% decode, -4.4% prefill at 20K, non-overlapping ranges) and which we only covered through natural traffic. We also did not measure raw NVMe bandwidth, deliberately: pushing IO at a model file behind a serving backend risks stalling prefill. **Why we still went back to `ram` + locked** — not because direct measured slower. At an indistinguishable speed range, locked is the side with a controlled comparison behind it (+6.0% over unlocked here, six vs six, Welch t=5.12; +0.2% on @fioruccione's box), it keeps PLE reads off the NVMe path entirely, and it is the configuration all of our baselines were measured on. Freeing 26.8 GiB bought nothing on this machine: `MemAvailable` was 60.1 GiB under direct vs 38.1 GiB locked, against a physical park gate that only refuses below 2.5 GiB available. Where @alexanderi96's reasoning does hold: direct really is close to free on this box, because the disks are fast and PLE reads are pure reads, so RAID5's read-modify-write penalty never enters. A box with a spinning disk, or memory tight enough that the residency policy picks `direct` by itself, is a different case — and on such a box `direct` is also the only option that actually removes those 26.8 GiB from memory rather than moving them into the reclaimable column. Read-only checks anyone can repeat while an engine is running: ``` awk '/MemAvailable|^Mlocked|Unevictable|^MemTotal/' /proc/meminfo p=$(pgrep -f "build/strat[a]" | head -1); grep -E "VmLck|VmRSS" /proc/$p/status pmap -x $p | sort -k3 -n | tail -15 grep -cE "\.bin|\.gguf|ngram|ple" /proc/$p/maps ``` Still unexplained on both machines: the mechanism behind the per-machine memlock difference.
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#2127
No description provided.