Skip to content

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
    • Help
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
N
neural-entrainment-audio2011
  • Project
    • Project
    • Details
    • Activity
    • Cycle Analytics
  • Issues 14
    • Issues 14
    • List
    • Board
    • Labels
    • Milestones
  • Merge Requests 0
    • Merge Requests 0
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Create a new issue
  • Jobs
  • Issue Boards
  • Nolan Batson
  • neural-entrainment-audio2011
  • Issues
  • #8

Closed
Open
Opened Oct 23, 2025 by Nolan Batson@nolanbatson963
  • Report abuse
  • New issue
Report abuse New issue

For Low-RAM Units, Include Memory Cgroups


Starting March 27, 2025, we recommend using android-latest-release as an alternative of aosp-fundamental to construct and contribute to AOSP. For extra info, see Adjustments to AOSP. Low memory killer daemon Keep organized with collections Save and categorize content material based mostly in your preferences. The Android low memory killer daemon (lmkd) process displays the memory state of a operating Android system and reacts to excessive memory pressure by killing the least essential processes to maintain the system performing at acceptable levels. An Android system operating multiple processes in parallel may encounter conditions when system memory is exhausted and processes that require more memory expertise noticeable delays. Memory strain, a state during which the system is running short on memory, requires Android to free memory (to alleviate the stress) by throttling or killing unimportant processes, requesting processes to free noncritical cached resources, and so on. Traditionally, Android monitored system memory stress using an in-kernel low memory killer (LMK) driver, a inflexible mechanism that relies on arduous-coded values.


As of kernel 4.12, the LMK driver is removed from the upstream kernel and the userspace lmkd performs memory monitoring and process killing duties. Android 10 and better help a new lmkd mode that uses kernel stress stall data (PSI) displays for memory stress detection. The PSI patchset in the upstream kernel (backported to 4.9 and 4.14 kernels) measures the period of time that tasks are delayed on account of memory shortages. As these delays immediately affect person experience, they symbolize a handy metric for determining memory strain severity. The upstream kernel additionally contains PSI displays that enable privileged userspace processes (resembling lmkd) to specify thresholds for these delays and to subscribe to events from the kernel when a threshold is breached. As a result of the vmpressure alerts (generated by the kernel for memory strain detection and utilized by lmkd) often embody quite a few false positives, lmkd should perform filtering to find out if the memory is underneath actual pressure.


This leads to pointless lmkd wakeups and using extra computational sources. Utilizing PSI screens outcomes in more accurate memory pressure detection and minimizes filtering overhead. The default is true, making PSI displays the default mechanism of memory pressure detection for lmkd. Low-RAM devices needed to be tuned aggressively, and even then would perform poorly on workloads with giant file-backed lively pagecache. The poor efficiency resulted in thrashing and no kills. The LMK kernel driver relied on free-Memory Wave Audio limits, with no scaling based mostly on the memory strain. Because of the rigidity of the design, companions often customized the driver in order that it could work on their devices. The LMK driver hooked into the slab shrinker API, which wasn't designed for Memory Wave heavy operations equivalent to looking for targets and killing them, which slowed down the vmscan process. The userspace lmkd implements the identical performance because the in-kernel driver but uses current kernel mechanisms to detect and estimate memory stress. Such mechanisms include utilizing kernel-generated vmpressure occasions or strain stall info (PSI) screens to get notifications about memory strain ranges, and utilizing memory cgroup options to limit the memory resources allocated to each course of based mostly on process significance.


In Android 9 and higher, userspace lmkd activates if an in-kernel LMK driver isn't detected. Userspace lmkd helps kill methods primarily based on vmpressure occasions or Memory Wave Audio PSI screens, their severity, and different hints similar to swap utilization. On low-memory units, the system ought to tolerate greater memory strain as a standard mode of operation. On high-performance gadgets, memory strain needs to be considered as an abnormal scenario and fastened before it affects general performance. Userspace lmkd additionally helps a legacy mode wherein it makes kill selections utilizing the same strategies as the in-kernel LMK driver (that is, free memory and file cache thresholds). Configure lmkd for a particular system using the following properties. Android eleven improves the lmkd by introducing a brand new killing strategy. The killing technique makes use of a PSI mechanism for memory stress detection introduced in Android 10. lmkd in Android 11 accounts for memory resource use levels and thrashing to stop memory starvation and efficiency degradation. This killing strategy replaces earlier methods and can be utilized on both high-performance and low-RAM (Android Go) devices. For low-RAM units, include memory cgroups. The memory killing strategy in Android 11 supports the tuning knobs and defaults listed under. These options work on each high-efficiency and low-RAM units.

Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
No due date
0
Labels
None
Assign labels
  • View project labels
Reference: nolanbatson963/neural-entrainment-audio2011#8