From f83d700d2a747ba3c23a3ce609f73f5db1d60e21 Mon Sep 17 00:00:00 2001 From: Krzysztof kuhy Rudnicki Date: Sun, 22 Nov 2026 14:52:06 +0100 Subject: [PATCH] Fix stale swappiness advice for zram Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01WzxdWUvCN36e1dx3Ejii1p --- .../swappiness-advice-2026-11-22.json | 20 +++++++++++++++++++ .../fixes/lib/arch_perf_probes.sh | 2 +- .../lib/tests/test_arch_perf_probes_health.sh | 8 ++++++-- 3 files changed, 27 insertions(+), 3 deletions(-) create mode 100644 docs/superpowers/evidence/swappiness-advice-2026-11-22.json diff --git a/docs/superpowers/evidence/swappiness-advice-2026-11-22.json b/docs/superpowers/evidence/swappiness-advice-2026-11-22.json new file mode 100644 index 00000000..52352f4d --- /dev/null +++ b/docs/superpowers/evidence/swappiness-advice-2026-11-22.json @@ -0,0 +1,20 @@ +{ + "intent": "Stop arch_perf_probes.sh advising vm.swappiness=10 now that the host runs 32 GiB zram at swappiness 100.", + "scope": [ + "linux_configuration/fixes/lib/arch_perf_probes.sh check_memory_pressure action text", + "linux_configuration/fixes/lib/tests/test_arch_perf_probes_health.sh", + "non-goal: ubuntu_perf_fixes.sh / fix_ubuntu_performance.sh (Ubuntu, no zram setup)" + ], + "changes": [ + "High-swap action now points at zramctl and the top memory users instead of lowering swappiness" + ], + "verification": [ + { + "command": "bash fixes/lib/tests/test_arch_perf_probes_health.sh", + "result": "pass", + "evidence": "RED 26 passed 3 failed; GREEN 29 passed 0 failed" + } + ], + "risks": ["Advice text only; no runtime behaviour change"], + "rollback": ["git revert the commit"] +} diff --git a/linux_configuration/fixes/lib/arch_perf_probes.sh b/linux_configuration/fixes/lib/arch_perf_probes.sh index 302901ce..485d7f51 100755 --- a/linux_configuration/fixes/lib/arch_perf_probes.sh +++ b/linux_configuration/fixes/lib/arch_perf_probes.sh @@ -158,7 +158,7 @@ check_memory_pressure() { echo "Swap usage: ${swap_pct}%" >>"$REPORT_FILE" if [[ $swap_pct -ge 35 && ${mem_available:-0} -gt $((mem_total / 3)) ]]; then add_finding "High swap usage while RAM is still available; this can cause stutter." - add_action "Consider lowering swappiness (temporary: sudo sysctl vm.swappiness=10)." + add_action "Swap is zram by design; check zramctl usage and the top memory users (ps aux --sort=-rss | head), then stop idle services." fi fi diff --git a/linux_configuration/fixes/lib/tests/test_arch_perf_probes_health.sh b/linux_configuration/fixes/lib/tests/test_arch_perf_probes_health.sh index a8d13c67..83c7787d 100755 --- a/linux_configuration/fixes/lib/tests/test_arch_perf_probes_health.sh +++ b/linux_configuration/fixes/lib/tests/test_arch_perf_probes_health.sh @@ -148,8 +148,12 @@ _t_contains "$(_t_report)" "Swap usage: 75%" \ "check_memory_pressure: computes the swap usage percentage" _t_contains "$(_t_findings)" "High swap usage while RAM is still available" \ "check_memory_pressure: flags heavy swapping while RAM is free" -_t_contains "$(_t_actions)" "lowering swappiness" \ - "check_memory_pressure: recommends lowering swappiness" +_t_lacks "$(_t_actions)" "swappiness" \ + "check_memory_pressure: does not suggest tuning swappiness (zram setup runs at 100)" +_t_contains "$(_t_actions)" "zramctl" \ + "check_memory_pressure: points at zramctl usage" +_t_contains "$(_t_actions)" "ps aux --sort=-rss" \ + "check_memory_pressure: points at the top memory users" # Heavy swap use with RAM genuinely exhausted is NOT the stutter signature, # so it must not be flagged.