Skip to content

Commit 0edc6a3

Browse files
committed
Merge remote-tracking branch 'origin/master' into dev-talesam
2 parents 61cb8b9 + 0f4fd58 commit 0edc6a3

7 files changed

Lines changed: 1358 additions & 843 deletions

File tree

include/swap-default.conf

Lines changed: 19 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,18 @@
99
# Swap Mode
1010
#
1111
# auto - Auto-detect best mode (default, recommended)
12-
# - btrfs/ext4/xfs -> zswap + swapfc
13-
# - others -> zram only
14-
# zswap+swapfc - Zswap + swap files (best for desktop/btrfs)
15-
# zram+swapfc - Zram + swap files (good for low RAM)
12+
# - Uses zswap when disk space >= 5x RAM
13+
# - Otherwise uses zram (saves disk space)
14+
# zswap+swapfile - Zswap + swap files (better performance, uses more disk)
15+
# zram+swapfile - Zram + swap files (less disk usage)
1616
# zram - Zram only (no disk swap)
17-
# manual - Use explicit settings below
17+
# disabled - Disable swap management (stops the service)
1818
################################################################################
1919

2020
swap_mode=auto
2121

2222
################################################################################
23-
# Zswap Settings (used in zswap+swapfc mode)
23+
# Zswap Settings (used in zswap+swapfile mode)
2424
#
2525
# Zswap compresses pages in RAM before writing to swap disk.
2626
# With ~3x compression ratio, 8GB RAM + 50% pool = ~12GB effective swap in RAM.
@@ -29,15 +29,14 @@ swap_mode=auto
2929

3030
## zswap_compressor=zstd # Compression: lz4 (fastest), zstd (balanced), lzo
3131
## zswap_max_pool_percent=50 # Max RAM % for compressed pool
32-
## zswap_zpool=zsmalloc # Allocator (zsmalloc is the only option in modern kernels)
3332
## zswap_shrinker_enabled=1 # Proactively move cold pages to disk
3433
## zswap_accept_threshold=85 # Resume accepting pages when pool drops to X%
3534

3635
################################################################################
3736
# Zram Settings (used in zram modes)
3837
#
3938
# Zram creates a compressed block device in RAM.
40-
# Unlike zswap, size is virtual (uncompressed) size, not RAM usage limit.
39+
# Size is virtual (uncompressed) size, not actual RAM usage.
4140
################################################################################
4241

4342
## zram_size=80% # Virtual size (e.g., 80%, 1G)
@@ -48,47 +47,25 @@ swap_mode=auto
4847
# Zram Writeback (optional, off by default)
4948
# Moves incompressible/idle pages to backing storage
5049
## zram_writeback=0
51-
## zram_writeback_size=1G # Initial backing file size
52-
## zram_writeback_max_size=8G # Max size
53-
## zram_writeback_threshold=50 # Trigger when zram is X% full
5450

5551
################################################################################
56-
# SwapFC - Dynamic Swap Files (used in swapfc modes)
52+
# SwapFile - Dynamic Swap Files (used in swapfile modes)
5753
#
58-
# Progressive scaling: starts with base size, doubles every N files.
59-
# With 32 files max and step=3: 1G -> 1G -> 1G -> 2G -> 2G -> 2G -> 4G...
60-
# Total capacity can reach hundreds of GB while using minimal disk initially.
54+
# Creates swap files dynamically when memory is low.
55+
# Files are created and removed automatically based on demand.
6156
################################################################################
6257

63-
swapfc_enabled=1
64-
swapfc_path=/swapfc/swapfile
65-
66-
# Size configuration (auto-detected based on RAM if commented)
67-
## swapfc_chunk_size=512M # Base chunk size (minimum 512M recommended)
68-
## swapfc_max_chunk_size=64G # Max single file size
69-
## swapfc_max_count=32 # Max files (kernel limit is 32)
70-
## swapfc_scaling_step=3 # Double size every X files
71-
72-
# Triggers (auto-tuned if commented)
73-
## swapfc_free_ram_perc=20 # Create swap when free RAM < X%
74-
## swapfc_free_swap_perc=40 # Create more when free swap < X%
75-
## swapfc_remove_free_swap_perc=70 # Remove files when free swap > X%
76-
77-
################################################################################
78-
# MGLRU Anti-Thrashing (Kernel 6.1+)
79-
#
80-
# Protects working set from premature eviction.
81-
# Auto-adjusted based on RAM: 1-2GB: 10s, 2-4GB: 5s, 4-8GB: 3s, 16GB+: 1s
82-
################################################################################
83-
84-
## mglru_min_ttl_ms=auto # Set to 0 to disable
58+
## swapfile_enabled=1 # Enable swap file management
59+
## swapfile_path=/swapfile # Base path for swap files
60+
## swapfile_chunk_size=512M # Size of each swap file
61+
## swapfile_max_count=32 # Maximum number of swap files
8562

8663
################################################################################
87-
# Sparse Files
64+
# MGLRU Anti-Thrashing
8865
#
89-
# Sparse files only use disk space when actually written to.
90-
# Enabled by default in zswap mode (disk space used only on writeback).
91-
# Pre-allocated files may have slight performance benefit but use more disk.
66+
# Protects active programs from being swapped out.
67+
# Prevents system freezes when memory is low.
68+
# Available values: auto, 0 (disabled), 100, 300, 600, 1000, 3000, 5000, 10000
9269
################################################################################
9370

94-
## swapfc_use_sparse_disable=1 # Uncomment to force pre-allocation
71+
## mglru_min_ttl_ms=auto # Time in milliseconds (auto adjusts based on RAM)

0 commit comments

Comments
 (0)