summaryrefslogtreecommitdiffstats
path: root/lmkd
Commit message (Collapse)AuthorAgeFilesLines
* lmkd: kill a process if zoneinfo can't be readColin Cross2014-07-141-2/+4
| | | | | | | | Opening /proc/zoneinfo may return -ENOMEM under memory pressure, assume something needs to be killed if that happens. Bug: 16236289 Change-Id: I25aab09f4c3f2b9e176eaaeca94fd6bd790dad4e
* lmkd: kill multiple tasksColin Cross2014-07-141-53/+88
| | | | | | | | | The task selected to die may be small, add its approximate size to other_free and other_file and keep killing until all thresholds are met. Bug: 16236289 Change-Id: Iceeca4c63fec98cae2bf53e258f7707cea408b07
* lmkd: use open instead of fopenColin Cross2014-07-141-27/+61
| | | | | | | | fopen and fgets require allocations, switch to open/read with stack allocated buffers. Bug: 16236289 Change-Id: I10586883fe78caf59d309eff7f7989b3e45beb7d
* lmkd: make lmkd SCHED_FIFOColin Cross2014-07-141-0/+5
| | | | | | | | | If kswapd runs more than lmkd it may throw away all page cache pages before lmkd gets a chance to kill a process. Make lmkd SCHED_FIFO so it can react quickly to kernel low memory notifications. Bug: 16236289 Change-Id: I46767b4ec81ef8638d0c9e47d168a68b62e3cac5
* lmkd: mlock all memoryColin Cross2014-07-141-0/+2
| | | | | | | | | | | Use mlockall(MCL_FUTURE) to lock all lmkd pages in memory. This avoids lmkd thrashing when the system is low on memory. As a side effect, it will also keep the .text sections of liblog, libm, libc, and libprocessgroup in memory at all times. Bug: 16236289 Change-Id: Idd70557efa4b1e14bc86f14220672a30f6c956e3
* lmkd: remove libcutils from LOCAL_SHARED_LIBRARIESColin Cross2014-07-141-1/+1
| | | | | | | | | While lmkd does technically use libcutils' socket.h, it only uses a static inline. Remove libcutils from LOCAL_SHARED_LIBRARIES so it doesn't end up mlock'd in memory in the next patch. Bug: 16236289 Change-Id: I744d69bfff06cb904836f64e1d5f6e530604bff4
* lmkd: use libprocessgroup to kill forked processesColin Cross2014-07-092-1/+3
| | | | | | | | After sending sigkill to the main process, also call into libprocessgroup to kill any processes that were forked. Bug: 15313911 Change-Id: I05577c6f5b70800ce0a01f480c8870c2c601afda
* lmkd: pass uid from ActivityManager to lmkdColin Cross2014-07-091-5/+8
| | | | | | | lmkd will use the uid to find processgroups and kill forked processes. Bug: 15313911 Change-Id: I3f7bb003ccf15650cae6ebc2c042ddeb4cc796fc
* Make lmkd dynamically linkedNick Kralevich2014-05-071-2/+1
| | | | | | | | | | | | Statically linked binaries cannot take advantage of ASLR, making them less secure. In addition, statically linked binaries consume more ram, because shared libraries cannot be reused. executable size before: 87728 executable size after: 13656 Change-Id: I9d02d865f9beeaaaadcd5009f64ac015931d4b11
* lmkd: turn on -WerrorMark Salyzyn2014-05-072-10/+14
| | | | | | - Deal with some -Wunused issues Change-Id: Id037c44a0ca2d00ae10a939fb001bc24a3e9410c
* low memory killer: switch to kernel oom_score_adj interfaceTodd Poynor2013-09-231-2/+14
| | | | | | | Use oom_score_adj for setting OOM score adjustment values instead of the older, deprecated oom_adj interface. Change-Id: I5ba7801d4b8971be092b31ae0fd8af8c3001d613
* Add lmkd low memory killer daemonTodd Poynor2013-08-302-0/+745
Move kernel low memory killer logic to new daemon lmkd. ActivityManager communicates with this daemon over a named socket. Change-Id: Ie957da7e9b1f7150e23c689fdadf23ff260b47be