lowmemorykiller misc notes
I’m reading code about in kernel lowmemorykiller, lets know about some concepts related.
- vmpressure: monitor Linux virtual memory management pressure
- kernel page reclaim: background reclaim/indrect reclaim/kswapd and direct reclaim
- kswapd: when free pages low at water page_low, it’s wakeup
- direct relaim: when alloc memory and no free memory, the thread will reclaim direcly, need avoid because of delay
- page thrashing: from net:too many page fault is called thrashing. CPU spend most of the time in page fault related activity than the useful work, it will degrade the system performance…, page fault need swaping in/out, too many swaping in/out is called page thrashing, u can vmstat 1 and look at swap device usage… The result is an unresponsive system and a very busy hard disk.when lmk is not killing, still has page thrashing, page thrashing will casue system performance degrade, so killing is better choice than thrashing.
- swappiness: ctl the kernel aggressiveness in swapping-out pages, 0-100, 100 means swap out pages as many pages as possible
- page fault: A major page fault is one that can only be satisfied by accessing the disk. A minor page fault can be satisfied by sharing pages that are already in memory.
About lmk, i think the confused parameter is minfree, how to set it? we know AMS will calculate the value by resolution and so on, but as i know qcom does not use it, it use his own tuned.
AMS code path:
framework/base/services/core/java/com/android/server/am/ProcessList.java:updateOomLevels |
Lets see the history adjusted by google/qcom:
Author: Dianne Hackborn <hackbod@google.com> |
ok, i think you got the rabbit.
And lets see below description about minfree:
Now, these minfree values are not typical on most devices these days as manufacturers love to tweak these to their liking depending on how they feel it best suits their device.
But what you should take away from this brief explanation is that the more free memory you have, the less likely you’ll see critical processes being killed off.
The main difference between a device with 2GB of RAM versus a device with 3GB of RAM is that the device with 3GB of RAM should be able to cache more processes in the background without triggering the LMK driver to kill it off.
at last lets see some call stack about lmk on QCOM_N:
[ 373.858334] CPU: 2 PID: 5687 Comm: CAM_startstats Tainted: G W 3.18.31-perf-g5e6acc4-00672-g606f204-dirty #31 |
Over.
版权声明:本站所有文章均采用 CC BY-NC-SA 4.0 CN 许可协议。转载请注明原文链接!