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:
Charan Teja Reddy <charante@codeaurora.org>
Loading
Please register or sign in to comment