Commit Graph

13 Commits

Author SHA1 Message Date
Nick Kralevich c68c8862f9 more O_CLOEXEC
Change-Id: I330aef8d6f1fc35d6649995ef312954b84dff555
2015-12-18 20:57:25 -08:00
Erik Kline 7e16cc15b5 Switch from using sockaddr to sockaddr_storage.
This is to ensure sufficient space is always available.

Change-Id: Ifa87b93ecdc90dcacbfb24446c872344da6703d3
2015-12-07 16:07:46 +09:00
Andreas Gampe c165b01a8b Lmkd: Fix unused variables
For build-system CFLAGS clean-up, fix unused variables.

Change-Id: I841192e92585814b8691d544cc48433b2ca1b3d3
2014-11-24 20:32:42 -08:00
Colin Cross f8857cc24a lmkd: kill a process if zoneinfo can't be read
Opening /proc/zoneinfo may return -ENOMEM under memory pressure,
assume something needs to be killed if that happens.

Bug: 16236289
Change-Id: I25aab09f4c3f2b9e176eaaeca94fd6bd790dad4e
2014-07-14 17:41:17 -07:00
Colin Cross 16b0946da1 lmkd: kill multiple tasks
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
2014-07-14 17:41:17 -07:00
Colin Cross ce85d955a3 lmkd: use open instead of fopen
fopen and fgets require allocations, switch to open/read with
stack allocated buffers.

Bug: 16236289
Change-Id: I10586883fe78caf59d309eff7f7989b3e45beb7d
2014-07-14 17:41:17 -07:00
Colin Cross 1a0d9be53e lmkd: make lmkd SCHED_FIFO
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
2014-07-14 17:41:17 -07:00
Colin Cross b28ff91313 lmkd: mlock all memory
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
2014-07-14 16:39:56 -07:00
Colin Cross fef9522d9b lmkd: use libprocessgroup to kill forked processes
After sending sigkill to the main process, also call into
libprocessgroup to kill any processes that were forked.

Bug: 15313911
Change-Id: I05577c6f5b70800ce0a01f480c8870c2c601afda
2014-07-09 17:24:39 -07:00
Colin Cross fbb78c6fee lmkd: pass uid from ActivityManager to lmkd
lmkd will use the uid to find processgroups and kill forked processes.

Bug: 15313911
Change-Id: I3f7bb003ccf15650cae6ebc2c042ddeb4cc796fc
2014-07-09 11:30:52 -07:00
Mark Salyzyn e6ed68bdf3 lmkd: turn on -Werror
- Deal with some -Wunused issues

Change-Id: Id037c44a0ca2d00ae10a939fb001bc24a3e9410c
2014-05-07 12:27:29 -07:00
Todd Poynor 16b6099476 low memory killer: switch to kernel oom_score_adj interface
Use oom_score_adj for setting OOM score adjustment values instead
of the older, deprecated oom_adj interface.

Change-Id: I5ba7801d4b8971be092b31ae0fd8af8c3001d613
2013-09-23 18:32:02 +00:00
Todd Poynor 3948f80f2a Add lmkd low memory killer daemon
Move kernel low memory killer logic to new daemon lmkd.  ActivityManager
communicates with this daemon over a named socket.

Change-Id: Ie957da7e9b1f7150e23c689fdadf23ff260b47be
2013-08-30 15:32:09 -07:00