Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 5669bb16 authored by Charan Teja Reddy's avatar Charan Teja Reddy Committed by Gerrit - the friendly Code Review server
Browse files

lowmemorykiller: don't take scan_mutex lock when low on memory



Every process performing reclaim through LMK, tries to obtain the
scan_mutex lock so that there is only one process in the LMK
section to avoid overkills. But when the system is very low on
memory condition, the lock contention will serialize the
LMK kills which can result into premature OOM due to slow
pace of killing tasks, which causes the alloc path to exhaust the
retries before entering OOM.

To avoid this situation, avoid taking the scan_mutex lock when the
system is low on memory so that multiple process entering into the
LMK, send kill signals to different process that can help in
avoiding the premature OOM.

The threshold for avoiding the locks is taken as half of the lowest
minfree level and when swap is full, which makes sure there is no
overkill even at the lowest adj level i.e. we intend to wait till we
confirm that the memory situation is too bad and page cache is
thrashing.

Change-Id: Ic40d59df1f3232d9a533660a150a01c27b94ae28
Signed-off-by: default avatarCharan Teja Reddy <charante@codeaurora.org>
parent 5cf45a00
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment