| name | p2-memory-engine |
| description | Implement or change Ola P2 memory engine (ZRAM, IO scheduler, idle compact/drop_caches). Use when the user mentions P2, ZRAM, 内存融合, IO 调度, compact_memory, drop_caches, MemoryEngineCard, or memory.rs. |
P2 Memory Engine
Decision lives in src/memory.rs. Hardware writes go only through src/action.rs. Policy fields are on ResourcePolicy and travel APK → DaemonClient.apply → ola apply (full serde) → resource_step → memory::apply_memory.
Constraints (do not revert)
- Do not reset
/sys/block/zram0/disksize when it is already non-zero. Resetting an active zram wipes swap.
- Init zram only when disksize is 0 and the user set a target MB.
drop_caches is pagecache only (echo 1). Never 2/3. Skip Game(1) and Video(2).
- Compact / drop only in idle: cpu < 15% and psi_io < 0.2, plus memory pressure. Rate limit 120s / 300s.
- IO scheduler writes
/sys/block/{dev}/queue/scheduler. Prefer sda on the SM7475 probe device (already bfq).
- Do not expand PPO
ACTION_DIM for these switches.
After a stage
Load session-memory and record the outcome with /home/wlq/wlq/record.sh.