Commit Graph

55 Commits

Author SHA1 Message Date
Suren Baghdasaryan 9ca5334683 lmkd: polling code cleanup
- Remove unused POLLING_STOP state
- Simplify POLLING_DO_NOT_CHANGE state handling
- Correct last_poll_tm assignment logic

Bug: 147315292
Test: lmkd_unit_test
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: If0674eda954a25f0f6c9188501ff77db8ba0813b
2020-04-29 15:11:15 -07:00
Suren Baghdasaryan 51ee4c505f lmkd: add kill when swap utilization is too high
When non-swappable allocations cause memory pressure swap will not be
depleted, however a high percentage of the swappable memory will be
pushed into swap. Detect this condition and kill a process when swap
utilization is too high while under memory pressure.
Introduce ro.lmk.swap_util_max property to represent max percentage of
the overall swappable memory that can be swapped under memory pressure
without triggering a kill. ro.lmk.swap_util_max is set to 100 by default
which disables kills due to the swap utilization.

Bug: 147315292
Test: ION memory hogger with ro.lmk.swap_util_max set to 95
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: I6dbf124bb24b220d136e8f16b3dae0c0c30d32ca
2020-04-29 15:11:02 -07:00
Muhammad Qureshi ed8fe8465a Use generated code for logging events to statsd
Use the autogenerated libstatslog_lmkd to send events to statsd

The logging schema for statsd is changing as part of statsd becoming
a Mainline module in R. The autogenerated code will handle the schema
change.

Bug: 145887874
Test: m -j
Test: atest android.cts.statsd.atom.UidAtomTests#testLmkKillOccurred

Change-Id: Ibae4cd822807369a799d5c1f6a9c51272e38a074
2020-01-13 12:16:47 -08:00
Suren Baghdasaryan 36baf44179 lmkd: Restrict lmkd unsolicited notifications only to subscribed recipients
lmkd unsolicited notifications can cause lmkd to block if clients are not
consuming them. Fix that by sending notifications to only subscribed
clients. Introduce LMK_SUBSCRIBE command to allow lmkd clients to subscribe
to event notifications. The only asynchronous event currently supported is
LMK_ASYNC_EVENT_KILL.

Bug: 146597855
Test: fill up send buffer using lmkd_unit_test
Test: confirm lmkd does not block after the fix
Change-Id: I014159aa55b59081f4b9ed53ecd160a49c0682bb
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2019-12-23 12:35:29 -08:00
Tom Cherry 43f3d2b190 Build lmkd as C++
Bug: 145669697
Test: build
Change-Id: I4fb2a9a900c8a6915ee84cc3d82434596301b24b
2019-12-13 08:40:30 -08:00