Swappiness Fix

@LeanHijosdesusMadres

Magisk KernelSU APatch
Magisk
Version
2.58 KB
Size
Sep 10, 2024
Updated

Module Info

  • Contributors LeanxModulostk
  • Source Code View Repository
  • Tags
    #Swappiness Fix #Memory Cgroup #RAM #Swap #Android Performance #Root Module

About this module

Swappiness Fix applies a predefined memory-cgroup profile after boot, giving system and application groups different swap preferences on compatible rooted Android devices.

A Fixed Memory-Cgroup Profile

Designed for ROMs that expose the legacy /dev/memcg control hierarchy used by the module.

Per-Group Values

Writes separate swappiness values for the root memory group, Android system processes, and user applications.

Boot-Time Application

Waits 60 seconds after service startup before applying its profile, allowing Android services to initialize first.

ROM-Dependent

The installer refuses unsupported devices when the expected system memory-cgroup swappiness node is absent.

Values Applied by the Module

Swappiness Fix memory-cgroup values
ControlValueRole
/dev/memcg/memory.swappiness100Root memory-cgroup setting.
/dev/memcg/system/memory.swappiness40Lower swap preference for processes assigned to the system group.
/dev/memcg/apps/memory.swappiness50Separate preference for user-application processes.

The service also attempts to place system_server, SurfaceFlinger, and supported graphics-composer services in the system cgroup. The effective result depends on the ROM's process names and cgroup implementation.

What to Expect

Swappiness is a preference, not a fixed promise about which application remains in memory. Android's low-memory killer, zRAM capacity, working-set pressure, and vendor memory policies continue to influence process retention. A profile that feels responsive on one device may increase reclaim work or provide no visible benefit on another.

Because the values are hard-coded, this package is best treated as a specific preset rather than a general memory tuner. Record baseline behavior before installation and compare app reloads, system responsiveness, and memory pressure under the same workload.