Commit Graph

545 Commits

Author SHA1 Message Date
Suren Baghdasaryan 48f7d0e49f lmkd: Add lmkd wakeup information into killinfo logs am: d7b4fcb8a5 am: 403c7fd536
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1371804

Change-Id: Ifcca19bbbb6c5d69f44edf20d34af824e9879060
2020-07-26 17:47:07 +00:00
Suren Baghdasaryan 403c7fd536 lmkd: Add lmkd wakeup information into killinfo logs am: d7b4fcb8a5
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1371804

Change-Id: I99560d361860d3c4d1e83f7b8ac219d57824f817
2020-07-26 17:32:08 +00:00
Suren Baghdasaryan d7b4fcb8a5 lmkd: Add lmkd wakeup information into killinfo logs
Oftentimes while investigating bugreports it's unclear whether lmkd
was active between kills. To provide visibility into lmkd activity
adding the following fields into killinfo reports:
MsSinceEvent - number of msecs since the last PSI/vmpressure event
MsSincePrevWakeup - number of msecs since the previous wakeup
WakeupsSinceEvent - number of wakeups since the last PSI/vmpressure
event
SkippedWakeups - number of wakeups that were skipped due to an
incomplete kill

Bug: 162034541
Test: lmkd_unit_test
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: I0356c27515132ff0dd309b59a8bf907acbd67cd8
2020-07-24 19:31:03 +00:00
Suren Baghdasaryan 0b8b47057e lmkd: Set default kill timeout to limit waits for uninterruptible processes am: 7d1f4f0047 am: 93060362b5
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1358623

Change-Id: I06968623ad7ea99ee61c001e367d3892249ed3a6
2020-07-11 03:18:24 +00:00
Suren Baghdasaryan 93060362b5 lmkd: Set default kill timeout to limit waits for uninterruptible processes am: 7d1f4f0047
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1358623

Change-Id: Iffcb4cbd88d44df216fce44c37ecace082df7d69
2020-07-11 03:07:04 +00:00
Suren Baghdasaryan 7d1f4f0047 lmkd: Set default kill timeout to limit waits for uninterruptible processes
When lmkd tries to kill a process in uninterruptible sleep state, it may
need to wait for a long time. To prevent this set the default kill timeout
to 100ms which should work for majority of the devices.

Bug: 160295034
Test: lmkd_unit_test
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: Ia280dc095df9ca8494278e0a75b976ed93fc04ae
2020-07-08 11:41:14 -07:00
Martin Liu 08d786c5bd [automerger skipped] lmkd: Fix do not kill perceptible apps due to low swap if above min wmark am: dfc73bc2fe -s ours
am skip reason: Change-Id Ifc09c2a1fe7e21faa096988f471644f63951d81c with SHA-1 3185c2d096 is in history

Original change: https://googleplex-android-review.googlesource.com/c/platform/system/memory/lmkd/+/11699841

Change-Id: Ied978dbd309a8876ed7a090120927b6818a70b80
2020-06-02 20:55:41 +00:00
Martin Liu 3a2aeaba0e lmkd: Fix do not kill perceptible apps due to low swap if above min wmark am: 3185c2d096 am: ff6ad5cd06
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1321895

Change-Id: I1533fc059bb1683e5bf9441a7b30e5e24e6f1f83
2020-06-02 17:27:00 +00:00
Martin Liu ff6ad5cd06 lmkd: Fix do not kill perceptible apps due to low swap if above min wmark am: 3185c2d096
Original change: undetermined

Change-Id: I1cb82bf5ff5da1dd29876354a54b2dd963088b37
2020-06-02 17:09:23 +00:00
Martin Liu dfc73bc2fe lmkd: Fix do not kill perceptible apps due to low swap if above min wmark
Fix code logic to obey our intetion of not killing perceptible apps
due to low swap if above min wmark.

Bug: 155709603
Test: boot
Signed-off-by: Martin Liu <liumartin@google.com>
Merged-In: Ifc09c2a1fe7e21faa096988f471644f63951d81c
Change-Id: Ifc09c2a1fe7e21faa096988f471644f63951d81c
2020-06-02 23:47:01 +08:00
Martin Liu 3185c2d096 lmkd: Fix do not kill perceptible apps due to low swap if above min wmark
Fix code logic to obey our intetion of not killing perceptible apps
due to low swap if above min wmark.

Bug: 155709603
Test: boot
Signed-off-by: Martin Liu <liumartin@google.com>
Merged-In: Ifc09c2a1fe7e21faa096988f471644f63951d81c
Change-Id: Ifc09c2a1fe7e21faa096988f471644f63951d81c
2020-06-02 23:43:49 +08:00
Suren Baghdasaryan 5b4b3716e4 [automerger skipped] lmkd: Do not kill perceptible apps due to low swap if above min wmark am: 7afa463978 -s ours
am skip reason: Change-Id I6beb4b55f8b4f7bc22818b5a7bdfa3adc6cd31c1 with SHA-1 48135c4cba is in history

Change-Id: Ia2bbfb9829b21d0214279edc7c245b5437d31593
2020-05-21 00:09:43 +00:00
Suren Baghdasaryan c9e47704a9 lmkd: Do not kill perceptible apps due to low swap if above min wmark am: 48135c4cba am: d6d8a3dc55
Change-Id: I8d6a9376c361279c9833b19afdaac5a83d8a9f2a
2020-05-20 21:25:29 +00:00
Suren Baghdasaryan 16657a940d [automerger skipped] lmkd: Set the default free swap threshold to 10% for all devices am: fb1f592602 am: 5132481e15 -s ours
am skip reason: Change-Id I443486763c034ed0603ea52b81c060c3969af9a5 with SHA-1 c2b228e498 is in history

Change-Id: I320b9b413fddfcc2ddd5dfbe2a3683dc5e5abae9
2020-05-20 21:25:27 +00:00
Suren Baghdasaryan e58fd35c27 [automerger skipped] lmkd: Fix min_score_adj to exclude killing foreground processes am: 5c039b53d8 am: d9ba0c99ae -s ours
am skip reason: Change-Id If187654b8001ce843ec6085ccd2042d75a986dae with SHA-1 0e589f61ba is in history

Change-Id: I007c16b6a8bc5de7a906b8ab4424d42212f5b3ce
2020-05-20 21:25:25 +00:00
Suren Baghdasaryan d6d8a3dc55 lmkd: Do not kill perceptible apps due to low swap if above min wmark am: 48135c4cba
Change-Id: I3ba7b9a0cab86a185cfc3c6d9f23d5ad677a0251
2020-05-20 20:59:14 +00:00
Suren Baghdasaryan 5132481e15 lmkd: Set the default free swap threshold to 10% for all devices am: fb1f592602
Change-Id: I52ada975e99ccf8d26091afbc8953ee40c491fd5
2020-05-20 20:59:13 +00:00
Suren Baghdasaryan d9ba0c99ae lmkd: Fix min_score_adj to exclude killing foreground processes am: 5c039b53d8
Change-Id: Iebe3f5c02c882cc47e5fb25cd14bff4ee9667482
2020-05-20 20:59:11 +00:00
Suren Baghdasaryan 7afa463978 lmkd: Do not kill perceptible apps due to low swap if above min wmark
Prevent kills of perceptible apps due to swap shortages unless system
free memory is below the min watermark. This prevents kills of important
apps when the system is recovering from the memory pressure.

Bug: 155709603
Test: memory stress test with multiple foreground apps
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Merged-In: I6beb4b55f8b4f7bc22818b5a7bdfa3adc6cd31c1
Change-Id: I6beb4b55f8b4f7bc22818b5a7bdfa3adc6cd31c1
2020-05-20 20:48:06 +00:00
Suren Baghdasaryan 48135c4cba lmkd: Do not kill perceptible apps due to low swap if above min wmark
Prevent kills of perceptible apps due to swap shortages unless system
free memory is below the min watermark. This prevents kills of important
apps when the system is recovering from the memory pressure.

Bug: 155709603
Test: memory stress test with multiple foreground apps
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: I6beb4b55f8b4f7bc22818b5a7bdfa3adc6cd31c1
2020-05-20 12:22:07 -07:00
Suren Baghdasaryan fb1f592602 lmkd: Set the default free swap threshold to 10% for all devices
Lower the min swap threshold to 10% for all devices to limit kills while
swap still has enough space.

Bug: 155709603
Test: memory stress test with multiple foreground apps
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Merged-In: I443486763c034ed0603ea52b81c060c3969af9a5
Change-Id: I443486763c034ed0603ea52b81c060c3969af9a5
2020-05-20 12:21:34 -07:00
Suren Baghdasaryan 5c039b53d8 lmkd: Fix min_score_adj to exclude killing foreground processes
In the cases when foreground processes should not be killed
min_score_adjust should be set above PERCEPTIBLE_APP_ADJ to prevent such
kills.

Bug: 155709603
Test: memory stress test with multiple foreground apps
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Merged-In: If187654b8001ce843ec6085ccd2042d75a986dae
Change-Id: If187654b8001ce843ec6085ccd2042d75a986dae
2020-05-20 12:21:10 -07:00
Suren Baghdasaryan deee65f222 lmkd: Set the default free swap threshold to 10% for all devices am: c2b228e498
Change-Id: Ie1d59e0bd1b840a3cb6644682e69ae3a33b7206e
2020-05-20 18:59:54 +00:00
Suren Baghdasaryan 025396b2c2 lmkd: Fix min_score_adj to exclude killing foreground processes am: 0e589f61ba
Change-Id: I06966970b96007f50689aa0b100cd11ef1f610a5
2020-05-20 18:59:49 +00:00
Suren Baghdasaryan 0d423bd611 [automerger skipped] lmkd: Enable stricter compiler checks am: 5096d16091 -s ours
am skip reason: Change-Id Ia802dbd7abb167d66b76390e269e4a4418ca5def with SHA-1 e538ba2df6 is in history

Change-Id: I71c445fc44e2da54b6e2016d21a77c6a1f34d964
2020-05-20 00:28:38 +00:00
Suren Baghdasaryan 742af8a026 [automerger skipped] lmkd: Remove unused variables and fix type mismatches am: dd7ec447ab -s ours
am skip reason: Change-Id I7f0839d803a6bf6532f077208ce54aba761dc9fe with SHA-1 ed715a3424 is in history

Change-Id: I4d3ef9cfe36b68a2aa177c7660974a8f31c29bf0
2020-05-20 00:28:36 +00:00
Suren Baghdasaryan f0e2037d23 [automerger skipped] lmkd: enable ro.lmk.kill_timeout_ms to be used with kill notifications am: c7e51b7b2a -s ours
am skip reason: Change-Id Ia3eed3448fd6928a5e634c2737044722048b3578 with SHA-1 03dccf35a1 is in history

Change-Id: I5fe0b9d7a442a0d729b0eec34719f004fcf0dfd1
2020-05-20 00:28:35 +00:00
Suren Baghdasaryan 3c092ca721 [automerger skipped] lmkd: polling code cleanup am: 3f84a211e5 -s ours
am skip reason: Change-Id If0674eda954a25f0f6c9188501ff77db8ba0813b with SHA-1 9ca5334683 is in history

Change-Id: I65d3c8f3f36cec703fb60bf44e7f098369ce9bf3
2020-05-20 00:28:34 +00:00
Suren Baghdasaryan c2b228e498 lmkd: Set the default free swap threshold to 10% for all devices
Lower the min swap threshold to 10% for all devices to limit kills while
swap still has enough space.

Bug: 155709603
Test: memory stress test with multiple foreground apps
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: I443486763c034ed0603ea52b81c060c3969af9a5
2020-05-20 00:20:40 +00:00
Suren Baghdasaryan 0e589f61ba lmkd: Fix min_score_adj to exclude killing foreground processes
In the cases when foreground processes should not be killed
min_score_adjust should be set above PERCEPTIBLE_APP_ADJ to prevent such
kills.

Bug: 155709603
Test: memory stress test with multiple foreground apps
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: If187654b8001ce843ec6085ccd2042d75a986dae
2020-05-20 00:20:14 +00:00
Suren Baghdasaryan 5096d16091 lmkd: Enable stricter compiler checks
Enable -Wall and -Wextra compiler flags to catch compilation warnings.

Bug: 147315292
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Merged-In: Ia802dbd7abb167d66b76390e269e4a4418ca5def
Change-Id: Ia802dbd7abb167d66b76390e269e4a4418ca5def
2020-05-19 15:53:36 -07:00
Suren Baghdasaryan dd7ec447ab lmkd: Remove unused variables and fix type mismatches
Fix compilation warnings by removing unused variables and add typecasting
whenever mixed type comparisons are performed.

Bug: 147315292
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Merged-In: I7f0839d803a6bf6532f077208ce54aba761dc9fe
Change-Id: I7f0839d803a6bf6532f077208ce54aba761dc9fe
2020-05-19 15:52:19 -07:00
Suren Baghdasaryan c7e51b7b2a lmkd: enable ro.lmk.kill_timeout_ms to be used with kill notifications
Allow lmkd to stop waiting for a kill notification if a kill takes longer
than ro.lmk.kill_timeout_ms.

Bug: 147315292
Test: lmkd_unit_test with ro.lmk.kill_timeout_ms set to 100
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Merged-In: Ia3eed3448fd6928a5e634c2737044722048b3578
Change-Id: Ia3eed3448fd6928a5e634c2737044722048b3578
2020-05-19 15:51:27 -07:00
Suren Baghdasaryan 3f84a211e5 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>
Merged-In: If0674eda954a25f0f6c9188501ff77db8ba0813b
Change-Id: If0674eda954a25f0f6c9188501ff77db8ba0813b
2020-05-19 15:50:18 -07:00
Kyeongdon Kim 63f45b46d6 lmkd: fix type warning from static analysis tools am: 65857db6a9 am: c93040a423
Change-Id: I67b40b195018c4da66b3bd7e375b0228412fcbc2
2020-05-12 20:22:31 +00:00
Kyeongdon Kim c93040a423 lmkd: fix type warning from static analysis tools am: 65857db6a9
Change-Id: Ie174a997b4f41b0d582893182b15039d8638f9ee
2020-05-12 20:09:12 +00:00
Kyeongdon Kim 65857db6a9 lmkd: fix type warning from static analysis tools
In memcg process stat path,
%u in format string (no.2) requires 'unsigned int'
but the argument type is 'signed int'.

Bug: NA
Test: check statslog with lmkd operation
Signed-off-by: Kyeongdon Kim <kyeongdon.kim@lge.com>
Change-Id: I3fcee57efbf26724878a81c8e1acd419aab8b95b
2020-05-12 19:56:46 +00:00
Suren Baghdasaryan 8e064f1260 lmkd: Enable stricter compiler checks am: e538ba2df6 am: 38855fe192
Change-Id: Ifc5b0fae35155aabee00007609296a11bfb8e855
2020-05-12 19:36:13 +00:00
Suren Baghdasaryan 9fad9a82c7 lmkd: Remove unused variables and fix type mismatches am: ed715a3424 am: 8fa0ac5c64
Change-Id: I8477920456afad113a20c0053c88d69463689d30
2020-05-12 19:36:12 +00:00
Suren Baghdasaryan 38855fe192 lmkd: Enable stricter compiler checks am: e538ba2df6
Change-Id: Ife625c2ab0886cd9333269edb92d5e39447b15f8
2020-05-12 19:19:55 +00:00
Suren Baghdasaryan 8fa0ac5c64 lmkd: Remove unused variables and fix type mismatches am: ed715a3424
Change-Id: Ibcce20a6b9d724e102740683df45a16a0dfb3708
2020-05-12 19:19:53 +00:00
Suren Baghdasaryan e538ba2df6 lmkd: Enable stricter compiler checks
Enable -Wall and -Wextra compiler flags to catch compilation warnings.

Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: Ia802dbd7abb167d66b76390e269e4a4418ca5def
2020-05-12 02:56:41 +00:00
Suren Baghdasaryan ed715a3424 lmkd: Remove unused variables and fix type mismatches
Fix compilation warnings by removing unused variables and add typecasting
whenever mixed type comparisons are performed.

Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: I7f0839d803a6bf6532f077208ce54aba761dc9fe
2020-05-11 19:52:52 -07:00
Suren Baghdasaryan 350685e461 [automerger skipped] lmkd: Add property re-initialization support am: c4081918a7 -s ours
am skip reason: Change-Id Ic60331f3368f5a7fdfe09ad7d47c7ccf0a497685 with SHA-1 1d0ebeaa9c is in history

Change-Id: Ia0eb7d23137c74f72b251034902fd0ed9faf8a28
2020-05-08 17:40:35 +00:00
Suren Baghdasaryan c4081918a7 lmkd: Add property re-initialization support
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>
Merged-In: Ic60331f3368f5a7fdfe09ad7d47c7ccf0a497685
Change-Id: Ic60331f3368f5a7fdfe09ad7d47c7ccf0a497685
2020-05-07 09:46:42 -07:00
Suren Baghdasaryan 2a5c69f8ee lmkd: Add property re-initialization support am: 1d0ebeaa9c am: 4434ef0223
Change-Id: I06dcc993601d96ae61a233f3f6538ce9d2062221
2020-05-07 16:14:55 +00:00
Suren Baghdasaryan 4434ef0223 lmkd: Add property re-initialization support am: 1d0ebeaa9c
Change-Id: I0d29bf11bb96a7b97174a0def2753ea169835802
2020-05-07 16:00:43 +00:00
Suren Baghdasaryan 1d0ebeaa9c lmkd: Add property re-initialization support
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
2020-05-06 15:05:04 -07:00
Suren Baghdasaryan 3967548543 lmkd: enable ro.lmk.kill_timeout_ms to be used with kill notifications am: 03dccf35a1 am: d77a36e91b
Change-Id: Ib92ac62009b7cefa3e265c29278080fabb51fb71
2020-04-30 00:33:25 +00:00
Suren Baghdasaryan f548154e2f lmkd: polling code cleanup am: 9ca5334683 am: 63123e1b84
Change-Id: I584542e05a7facac1c41c81549d31cd3edcdc2d4
2020-04-30 00:33:19 +00:00