/sys/fs/bpf/map_gpu_mem_gpu_mem_total_map BPF map exposes total GPU
allocations size. Include this value into killinfo reports to track GPU
allocation size at the time of the kill.
Bug: 189366037
Test: lmkd_unit_test
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: Icc1ed8ab2593530fa293ff9c82f6c8dc400485f5
Merged-In: Icc1ed8ab2593530fa293ff9c82f6c8dc400485f5
- Added new lmkd message for clients to subscribe LMK_ASYNC_EVENT_STAT
- Added support to write kill & mem stats information via data socket
to be read & parsed on the AMS Java side for future logging to statsd
Bug: 184698933
Test: lmkd_unit_test - test check_for_oom tests lmkd message send to AMS
Test: statsd_testdrive 51 54 to inspect statsd logged atoms data
Change-Id: Id682a438c87b3e4503261d26461f6cee641d86c4
Added SPDX-license-identifier-Apache-2.0 to:
Android.bp
libpsi/Android.bp
tests/Android.bp
Bug: 68860345
Bug: 151177513
Bug: 151953481
Test: m all
Exempt-From-Owner-Approval: janitorial work
Change-Id: I5fed190764c763388c50c2fea58c5c421579bd30
LMK events are an important platform memory monitoring signal. Enable
them by default.
Changes:
- Compile lmkd with statsd by default
- Signal lmkd by default
Test: build, statsd cts
Bug: 177985094
Change-Id: I070660767db6e3bc8926ff82b64b99c7ee9a0108
Add --reinit command-line option to allow updating lmkd properties. For
example to enable debug logging in the running lmkd process user should
issue:
setprop ro.lmk.debug true
lmkd --reinit
Bug: 155149944
Test: lmkd_unit_test after resetting lmkd properties
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: Ic60331f3368f5a7fdfe09ad7d47c7ccf0a497685
As part of moving libstatssocket into statsd apex, libstatssocket will
only be available as a shared library.
Bug: 145923416
Test: m
Change-Id: Ia6b13dcd378011c201b2595d2b3f3fc14213011b
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
In order to register native services init needs ability to communicate with
lmkd. Make liblmkd_utils library available in recovery mode so that init
can link to it and add a data socket in lmkd to support additional
connection from init. Ensure SOCK_CLOEXEC type for lmkd socket to prevent
init children from inheriting it.
Bug: 129011369
Test: boot and verify native service registration
Change-Id: Iaa4f59282fb10f838f6811571e97d55754b1bd41
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Move statsd related code out of lmkd.c to minimize ifdefs sprinkled around
the code and make it more maintainable.
Bug: 74119935
Test: lmkd_unit_test
Change-Id: Ib22f90fd380b9a31e09ab18ef16787bc07415ddf
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
With new psi monitor support in the kernel lmkd can use it to register
custom pressure levels. Add lmkd support for psi monitors when they are
provided by the kernel and use them by default. When kernel does not
support psi lmkd will fall back to vmpressure usage.
Add ability to poll memory status after the initial psi event is triggered
because kernel throttles psi memory pressure events to one per PSI tracking
window (currently set to 1sec). Current implementation polls every 200ms
for 1sec duration after the initial event is triggered.
If ro.lmk.use_psi is set to false psi logic will be disabled even when psi
is supported in kernel.
Bug: 111308141
Test: lmkd_unit_test
Change-Id: I685774b176f393bab7412161773f5c9af51e0163
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
This reverts commit 1bef8c550c6c9118969a93f14d9c5933cb7b2811.
Reason for revert: AOSP is fixed with new vendor image
Change-Id: Ib341ac80e2f88c13a7815a490ea2d9422ebdf55f
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
While troubleshooting memory pressure related issues it's hard to get a
good view of the memory state when lmkd kill happens. Logging relevant
information from /proc/meminfo file that was used to make a kill decision
is very helpful for further analysis. To do this efficiently we are using
Android Logger event library functions and log the data used for kill
decision after the kill signal was issued.
Test: Run lmkd_unit_test and logcat -b events -v descriptive
Change-Id: Id5de41b9d91a04dd5d3eb9b85d4e1babe9755628
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
1. let logs be written to statsd directly like all other stats logs.
+ stats log should not write to logd anymore(b/78239479)
2. fixed the log format
+ need to embed the elapsed real time in the log
3. fixed the log context reuse problem
+reset the log context buffer and internal state before reuse
Bug: 78603347
Bug: 78239479
Test: tested with alloc_stress, and saw logs written to statsd
performance measurement (memory & cpu):
https://paste.googleplex.com/5508158646648832
Change-Id: I345f0eace8ba1687ff480fb88e9abba1d8533f76
Move process initialization, mlockall() and sched_setscheduler() to
only occur if initialization succeeds and is enabled. This
conserves mlock'd memory and a FIFO processing slot if (deprecated)
kernel lowmemorykiller is active.
Cleanup: Android coding standard compliance.
Test: lmkd_unit_test
Bug: 33808187
Bug: 72838192
Change-Id: I51af0235c8eca4ef958ef2d83a8071ff58b49d78
(cherry pick from commit 0f1005180513e880bf7c90a3f2c2bf1a36aa1406)
A number of tools and tests require communication with lmkd.
In order to avoid code duplication liblmkd_utils implements
functions commonly used when interacting with lmkd process.
Isolate communication protocol details into lmkd.h
Bug: 63631020
Change-Id: Id840983d55b7db60013d52dee0c3187943811822
Merged-In: Id840983d55b7db60013d52dee0c3187943811822
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
(cherry pick from commit c71355991d4bafb4694f6252ac10e288a5fb9f75)
For tracing lmkd kills inside kernel it is useful to have traces
indicating when and which process lmkd is killing. By default the
tracing is disabled.
Bug: 63631020
Test: alloc-stress
Change-Id: I3ceb2bde0c292eec55855cb4535927f3b4c5d08b
Merged-In: I3ceb2bde0c292eec55855cb4535927f3b4c5d08b
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
It implements logging of following atoms:
-- LMK_STATE_CHANGED
-- LMK_KILL_OCCURRED
We would like to gather memory metrics of the process killed by LMKD
because by gathering this info we would be able to analyze and improve
system health by potentially reducing memory footprint of the process.
This feature would be available on production builds.
To know more about this see: http://go/android-p-memory-metrics
Bug: 65738734
Test: Tested manually
Change-Id: I064e0cdcb47c3b4c95d8b8d5654050c9812008d8
A number of tools and tests require communication with lmkd.
In order to avoid code duplication liblmkd_utils implements
functions commonly used when interacting with lmkd process.
Isolate communication protocol details into lmkd.h
Bug: 63631020
Change-Id: Id840983d55b7db60013d52dee0c3187943811822
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
For tracing lmkd kills inside kernel it is useful to have traces
indicating when and which process lmkd is killing. By default the
tracing is disabled.
Bug: 63631020
Test: alloc-stress
Change-Id: I3ceb2bde0c292eec55855cb4535927f3b4c5d08b
Signed-off-by: Suren Baghdasaryan <surenb@google.com>