The lmkd run wrong for Go devices, because min_score_adj is unused
when use_minfree_levels is set TURE.
Bug: 237947900
Signed-off-by: Yuming Han <yuming.han@unisoc.com>
Change-Id: I717561cd9e5f4d1a2ca60d9fc84adcd6e129420a
Fix the text of the warning when pthread_setschedparam fails to set
SCHED_OTHER scheduling policy for a reaper thread.
Bug: 237180716
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: I1b04713d145f4f3c243f16f932c753f5b06d48e6
Reaper threads can take considerable time to free target's
memory running at RT priority that they inherit from LMKD.
This might prevent other critical tasks from being scheduled
while reaper threads are active.
Explicitly set reaper threads to run under normal scheduling
policy but set their nice value to ANDROID_PRIORITY_HIGHEST.
Bug: 237180716
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: Idad817e698ae1d5ac6cee5aa3281c69c7e0d257f
Both pgscan_kwsapd and pgscan_direct are defined as unsigned long,
the overflow issues occur on ARM kernel space. Just check whether
their values changed.
Signed-off-by: Yuming Han <yuming.han@unisoc.com>
Change-Id: I73b27855ede9ca729208775e982660bae967ab92
The size of the vmstat_field_names array should correspond to the number
of elements in vmstat_field enum (VS_FIELD_COUNT).
Bug: 227769256
Reported-by: Yuming Han <yuming.han@unisoc.com>
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: Icac2810c4efca2a07cefba6e220165ef4f194867
If hooks are enabled in LMKD and kill_info is not supplied to
kill_one_process, there will be a null dereference on kill_info. This
changes validates ki before dereferencing.
Bug: b/210075795
Test: cq
Change-Id: Ie81ca9bdb73a71f16dc5682c8721a557b8b094fb
Merged-In: Ie81ca9bdb73a71f16dc5682c8721a557b8b094fb
Adds several hooks to LMKD that can be overridden by the vendor. This
allows for device specific control of LMKD when necessary.
Bug: b/210075795
Test: cq
Change-Id: Ib231743183134b05148d45d681765860da6274ae
(cherry picked from commit 2c1248381a52fc520c6cd1acfaee80818eaa9ee1)
Merged-In: Ib231743183134b05148d45d681765860da6274ae
which was CgroupEventControl before, but it's not the one
that definied in system/core/libprocessgroup/profiles/task_profiles.json.
And it causes lmkd crash for some setups like 4.19q + AOSP Master
Bug: 230642311
Test: boot the 4.19q + AOSP master setup with hikey960 board
Signed-off-by: Yongqin Liu <yongqin.liu@linaro.org>
Change-Id: I87b1ea2040f21c52d549db58692fc8a2b114f8e6
Prevent comparing uninitialized poll_start_tm with curr_tm in call_handler().
The bug caused by this has been fixed by the commit: d816ab.
But the main bug is not fixed yet and it may cause problem
in later if we add another operations in this if block.
Change-Id: Id13318297a2cbf2f9784134a2ccd648cc221e8c4
Signed-off-by: Yoonjae Jeon <yj213.jeon@samsung.com>
Use the /sys/fs/cgroup/uid_%u/pid_%u path instead of
/dev/memcg/apps/uid_%u/pid_%u" if the memcg controller is mounted in the
v2 cgroup hierarchy. Skip the code that refers to memcg attributes that
only exist in the cgroup v1 hierarchy when using the v2 memcg. Complain
if it is attempted to use the old kill strategy in combination with
memcg v2 since only the new strategy is compatible with the v2 cgroup
hiearchy.
Bug: 213617178
Test: Tested lmkd inside the Cuttlefish emulator. Triggered an
Test: out-of-memory condition as follows:
Test: i=0; while [ $i -lt 16 ]; do dd if=/dev/zero of=/dev/null bs=1G count=1 & ((i++)) done
Test: That caused the following output to appear in logcat:
Test: 02-03 18:13:02.772 241 241 I lowmemorykiller: Kill 'com.android.packageinstaller' (3031), uid 10022, oom_score_adj 975 to free 29348kB rss, 21232kB swap; reason: min watermark is breached and swap is low (135016kB < 150384kB)
Test: 02-03 18:13:02.772 241 241 I killinfo: [3031,10022,975,0,29348,3,73644,98460,8,1000,33448,40220,1503848,135016,81720,1387040,27268,29520,50348,103164,20176,57664,0,0,0,519,103,5,0,21232,30016,0,2]
Test: From the kernel log:
Test: [ 302.834958] Out of memory: Killed process 3017 (ADB-JDWP Connec) total-vm:13522856kB, anon-rss:0kB, file-rss:0kB, shmem-rss:560kB, UID:10052 pgtables:1008kB oom_score_adj:975
Test: [ 303.223702] Out of memory: Killed process 2859 (HeapTaskDaemon) total-vm:13534452kB, anon-rss:0kB, file-rss:0kB, shmem-rss:560kB, UID:10051 pgtables:1060kB oom_score_adj:965
Test: [ 303.478833] Out of memory: Killed process 2816 (Signal Catcher) total-vm:13524108kB, anon-rss:0kB, file-rss:0kB, shmem-rss:564kB, UID:10073 pgtables:1016kB oom_score_adj:965
Test: [ 304.823796] Out of memory: Killed process 2438 (ReferenceQueueD) total-vm:13529180kB, anon-rss:0kB, file-rss:0kB, shmem-rss:568kB, UID:10015 pgtables:1056kB oom_score_adj:955
Test: [ 305.226728] Out of memory: Killed process 3126 (DefaultDispatch) total-vm:13532596kB, anon-rss:0kB, file-rss:0kB, shmem-rss:528kB, UID:10019 pgtables:1064kB oom_score_adj:945
Test: [ 305.935615] Out of memory: Killed process 2637 (Jit thread pool) total-vm:13523084kB, anon-rss:0kB, file-rss:0kB, shmem-rss:0kB, UID:10024 pgtables:1036kB oom_score_adj:935
Test: [ 307.055895] Out of memory: Killed process 2063 (HeapTaskDaemon) total-vm:13755876kB, anon-rss:0kB, file-rss:0kB, shmem-rss:11600kB, UID:10074 pgtables:1552kB oom_score_adj:0
Test: [ 307.398512] Out of memory: Killed process 2298 (rs.media.module) total-vm:13560404kB, anon-rss:12924kB, file-rss:0kB, shmem-rss:720kB, UID:10076 pgtables:1156kB oom_score_adj:-700
Test: [ 309.888679] Out of memory: Killed process 1745 (droid.bluetooth) total-vm:13720424kB, anon-rss:11084kB, file-rss:0kB, shmem-rss:208kB, UID:1002 pgtables:1220kB oom_score_adj:-700
Test: [ 311.050133] Out of memory: Killed process 1759 (ndroid.systemui) total-vm:13852268kB, anon-rss:26468kB, file-rss:0kB, shmem-rss:6988kB, UID:10075 pgtables:1628kB oom_score_adj:-800
Test: [ 313.520057] Out of memory: Killed process 2000 (m.android.phone) total-vm:13593404kB, anon-rss:14600kB, file-rss:236kB, shmem-rss:340kB, UID:1001 pgtables:1312kB oom_score_adj:-800
Test: [ 314.337744] Out of memory: Killed process 1911 (rkstack.process) total-vm:13540420kB, anon-rss:8232kB, file-rss:0kB, shmem-rss:180kB, UID:1073 pgtables:1128kB oom_score_adj:-800
Test: [ 314.745542] Out of memory: Killed process 1984 (com.android.se) total-vm:13525236kB, anon-rss:6944kB, file-rss:0kB, shmem-rss:188kB, UID:1068 pgtables:1012kB oom_score_adj:-800
Test: [ 315.007212] Out of memory: Killed process 677 (system_server) total-vm:15049836kB, anon-rss:1856kB, file-rss:0kB, shmem-rss:240kB, UID:1000 pgtables:2084kB oom_score_adj:-900
Change-Id: I78821bcd332af7b3f642f037faa2df15a937dc26
Signed-off-by: Bart Van Assche <bvanassche@google.com>
Retrieve cgroup attribute paths from task_profiles.json instead of
hardcoding these paths.
Bug: 213617178
Test: Tested lmkd in Cuttlefish.
Change-Id: I03f40ac8ccd4635f21432214e1acf997c505d1e9
Signed-off-by: Bart Van Assche <bvanassche@google.com>
Add psi memory, io and cpu 10sec averages into killinfo reports.
Bug: 205182133
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Signed-off-by: Martin Liu <liumartin@google.com>
Change-Id: Ifbcf47cab291fb20dbf0b5d32f1965f4e6462b49
Merged-In: Ifbcf47cab291fb20dbf0b5d32f1965f4e6462b49