Skip to content

Commit 986ca9a

Browse files
committed
Simplified
1 parent c96780d commit 986ca9a

17 files changed

Lines changed: 584 additions & 592 deletions

CLAUDE.md

Lines changed: 0 additions & 208 deletions
This file was deleted.

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ clap = { version = "4", features = ["derive"] }
1212
nix = { version = "0.29", features = ["fs", "process", "signal", "user", "feature"] }
1313
libsystemd = "0.7"
1414
glob = "0.3"
15+
libc = "0.2"
1516
signal-hook = "0.3"
1617
thiserror = "2"
1718
pathdiff = "0.2"

include/swap-default.conf

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
# zswap+swapfile - Zswap + swap files (better performance, uses more disk)
1515
# zram+swapfile - Zram + swap files (less disk usage)
1616
# zram - Zram only (no disk swap)
17+
# manual - Use explicit flags (zram_enabled, zswap_enabled, swapfc_enabled)
1718
# disabled - Disable swap management (stops the service)
1819
################################################################################
1920

@@ -28,6 +29,7 @@ swap_mode=auto
2829
################################################################################
2930

3031
## zswap_compressor=zstd # Compression: lz4 (fastest), zstd (balanced), lzo
32+
## zswap_zpool=zsmalloc # Memory allocator: zsmalloc (only option in modern kernels)
3133
## zswap_max_pool_percent=50 # Max RAM % for compressed pool
3234
## zswap_shrinker_enabled=1 # Proactively move cold pages to disk
3335
## zswap_accept_threshold=85 # Resume accepting pages when pool drops to X%
@@ -40,7 +42,7 @@ swap_mode=auto
4042
################################################################################
4143

4244
## zram_size=80% # Virtual size (e.g., 80%, 1G)
43-
## zram_alg=lz4 # Compression: lz4 (fast), zstd (better ratio)
45+
## zram_alg=zstd # Compression: zstd (balanced), lz4 (fast)
4446
## zram_mem_limit=70% # Max physical RAM zram can use (OOM protection)
4547
## zram_prio=32767 # Priority (max = 32767)
4648

man/swap.conf.5

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ and
4949
Percentage of ram that can be compressed.
5050
.I
5151
.IP zswap_zpool=
52-
Set wich compressed memory pool to use, if unsure use z3fold.
52+
Set wich compressed memory pool to use, if unsure use zsmalloc.
5353
.PP
5454
The following options are available in the "zram" section:
5555
.I

pkgbuild/PKGBUILD

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ package() {
4141
# Install user config
4242
install -Dm644 include/swap-default.conf "${pkgdir}/etc/systemd/swap.conf"
4343

44+
# Install sysctl config (swappiness + page-cluster tuning)
45+
install -Dm644 include/99-systemd-swap.conf "${pkgdir}/usr/lib/sysctl.d/99-systemd-swap.conf"
46+
4447
# Install man pages
4548
install -Dm644 man/swap.conf.5 "${pkgdir}/usr/share/man/man5/swap.conf.5"
4649
install -Dm644 man/systemd-swap.8 "${pkgdir}/usr/share/man/man8/systemd-swap.8"

post-install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ echo ""
236236

237237
print_info "Compressor: ${BOLD}LZ4${NC} (2-3x mais rápido)"
238238
print_info "Pool Zswap: ${BOLD}50%${NC} (~20GB swap em RAM)"
239-
print_info "Allocator: ${BOLD}z3fold${NC} (menos overhead)"
239+
print_info "Allocator: ${BOLD}zsmalloc${NC} (allocator padrão)"
240240
print_info "Chunk Size: ${BOLD}1GB${NC} (melhor para NVMe/SSD)"
241241
print_info "Anti-Thrashing: ${BOLD}5000ms${NC} (proteção forte)"
242242
print_info "Pré-alocação: ${BOLD}Habilitada${NC} (melhor performance)"

0 commit comments

Comments
 (0)