Repository navigation
perf(system-optimize): tune zram sizing and swap policy - #59
Merged
Merged
Conversation
Cap the large-memory zram expression at 8 GiB, render swap-priority explicitly, unify swappiness at 100 for the pure-zram case, narrow the THP defrag conversion to always, and split the comma-bearing size expression correctly.
LucaLin233
force-pushed
the
forge/perf-zram-parameters
branch
from
October 23, 2026 18:48
ad30e93 to
9c3f66a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
>4 GiB档容量表达式改为min(ram / 2, 8192),避免大内存主机按比例生成过大的逻辑 zram。swap-priority = 100,为将来低优先级磁盘 swap 保留排序契约。vm.swappiness统一为 100,不再按内存档位递减。defrag只把always转为defer+madvise;已有defer/madvise/never保持不变。min(ram / 2, 8192)自带逗号导致的 swappiness 解析错误(${config%,*}/${config##*,})。Scope
仅现有参数计算、配置渲染、匹配判据与测试;不新增磁盘 swap、容器限额或 PostgreSQL 参数。本分支基于
forge/fix-zswap-systemd,PR 1 合并后需 rebase 到main再合并。Validation
tests/test-system-optimize.sh175 条断言通过;shellcheck 通过。ram * 1.5、swap-priority = 100、swappiness = 100;重复 install 幂等(rc=0,不重建设备);restore initial后 swappiness 回到 60、配置文件与基线一致。min(ram / 2, 8192)的解析仅在 ≤4 GiB 主机验证了另一分支;>16 GiB 场景未实测。Risks
Rollback
恢复安装前配置与运行快照;设备容量/算法/priority 等待安全重启,不强制
swapoff。