mirror of
https://github.com/archr-linux/Arch-R.git
synced 2026-03-31 14:41:55 -07:00
This commit introduces a comprehensive overhaul of memory management across all
supported ROCKNIX devices. It deprecates legacy swap scripts in favor
of a new, robust rocknix-memory-manager service.
Key Changes:
1. New Memory Manager (rocknix-memory-manager):
- Implements a Tiered Memory Architecture to replace legacy mount-swap.
- Smart "zstd" Interpretation: If ZRAM_ALGO is set to "zstd", the manager
automatically configures a hybrid pipeline:
- Primary: LZO-RLE (Low latency) for immediate writes.
- Secondary: ZSTD (High compression) for background recompression
of idle pages using multi-comp support.
- Tuning: Applies dynamic sysctl optimizations including vm.swappiness=100
and vm.page-cluster=0 for ZRAM-backed targets.
2. Kernel Configuration Standardization:
- Modular ZRAM/ZSMALLOC: Converted to =m to allow runtime algorithm switching
and hybrid tiering.
- Pressure Monitoring: Enabled CONFIG_PSI=y for real-time memory pressure
metrics.
- Deduplication: Enabled CONFIG_KSM=y to allow the manager to trigger page
merging based on hardware performance tiers.
- Stability: Enabled CONFIG_CGROUP_FREEZER=y for consistent suspend/resume
handling across all targets.
- Performance: Standardized THP to madvise to reduce compaction-induced
UI stutter.
3. Platform Specifics:
- SM8650 Hardware Alignment: Preserved target-specific in-place settings for
CONFIG_DRM_PANEL_AR14=y and CONFIG_PCI_PWRCTRL_UPD720201=m.
- SDM845: Enabled architecture-specific FREEZER and PSI options.
4. 'Auto' ZRAM Sizing Logic:
The memory-manager calculates ZRAM size based on total system RAM:
| RAM Tier | System Memory | Calculated ZRAM Size (Auto) |
| :------- | :------------ | :-------------------------- |
| Low RAM | < 2GB | 75% of Total RAM |
| Mid RAM | 2GB - 8GB | 50% of Total RAM |
| High RAM | > 8GB | Fixed at 6144 MB |
5. Defaults and Overrides:
- High-Performance Targets (RK3588, S922X, SM8x50): Default to "Auto" ZRAM
sizing and "zstd" profile.
- Low-Power Targets (RK3326, RK3566, H700): Default to ZRAM disabled ("0")
to conserve system resources.
- Users can override by copying /etc/swap.conf to /storage/.config/swap.conf.
- rocknix-memory-manager now can manipulate overides via arugments and live
```--reload``` functionality making it easier to integrate into ES
6. System Services:
- Added rocknix-memory-manager.service (oneshot).
- Updated util-linux to enable fallocate for instant swap generation.