Commit Graph

739 Commits

Author SHA1 Message Date
Ioannis Ilkos 282437fbbe Reorder swap field in killinfo
Some tools might parse killinfo entries based on the field order. Move
the newly added swap field to the end to ensure compatibility.

Test: build
Change-Id: Id6dad850beba6835f061da95e84190d00a1b26a0
2021-03-04 17:50:05 +00:00
Ioannis Ilkos bd6991af02 Log killed process swap size am: 4884890305
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1595271

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I57719767560f040d95508b86719ab4ee92cde599
2021-02-26 19:11:07 +00:00
Chris Morin 2c432eaf62 Replace mentions of "oom_adj" with "oom_score_adj" am: 74b4df95b4
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1607288

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I25d37095e413f5e62f327f0275ae888ac7a1be41
2021-02-26 17:15:37 +00:00
Ioannis Ilkos 4884890305 Log killed process swap size
We already log the rss size for the process. Given lmkd strategies also consider low swap, it will be beneficial to record the swap size too.

Test: build, manual test
Change-Id: I923f733f7a3aa77fc5968827693b0fc085819174
2021-02-26 17:05:35 +00:00
Chris Morin 74b4df95b4 Replace mentions of "oom_adj" with "oom_score_adj"
Some log messages mention "oom_adj" instead of "oom_score_adj" when
referring to oom_score_adj. This is confusing because "oom_adj" is a
separate value which was supplanted by oom_score_adj, but can still be
used.

Test: trigger memory pressure and view logs
Change-Id: I23825083cecfff6bd32bfb39c6dac1f2b17a72a7
2021-02-26 00:07:16 -08:00
Xin Li b88ab3d63f Mark ab/7061308 as merged in stage.
Bug: 180401296
Merged-In: Iaf7197de5b8b1632357d239aedc58589dfa01ca8
Change-Id: Ief78eca564efa0a41297a15c21f7e8e14fe57bdf
2021-02-20 00:24:41 -08:00
Bob Badour 04cea7c607 [LSC] Add LOCAL_LICENSE_KINDS to system/memory/lmkd am: 0bc044bc32
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1589007

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I1e0fd1880b7b45a980877b88ac26c53763b8e340
2021-02-16 18:18:47 +00:00
Bob Badour 0bc044bc32 [LSC] Add LOCAL_LICENSE_KINDS to system/memory/lmkd
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
2021-02-12 18:10:32 -08:00
Suren Baghdasaryan 475a02ffac lmkd_test: remove memcg creation on non-AndroidGo devices am: d7146e0f54
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1556790

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ifb5b2ab44681912dd7f70679f3c350f6b27b0be4
2021-01-22 19:10:26 +00:00
Suren Baghdasaryan d7146e0f54 lmkd_test: remove memcg creation on non-AndroidGo devices
Memory cgroups are disabled on non-AndroidGo devices. Change the test
not to fail due to missing in-kernel memory cgroup support.

Bug: 172296409
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: I35d724c23c22e97458976c1cad45fe9d993326f9
2021-01-21 22:37:03 +00:00
Ioannis Ilkos ae7021b38f Change lmkd defaults for statsd events am: dab3944256
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1555318

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I07d9136c5bb3467f6538b8d91a952d0a32db4fcf
2021-01-21 00:58:30 +00:00
Ioannis Ilkos dab3944256 Change lmkd defaults for statsd events
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
2021-01-20 20:08:19 +00:00
Treehugger Robot 019502f8ff Merge "lmkd: Add clang format symlink" am: 9fc38629dc am: b7315ea3b6
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1510010

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Iaf7197de5b8b1632357d239aedc58589dfa01ca8
2020-12-30 20:18:48 +00:00
Treehugger Robot b7315ea3b6 Merge "lmkd: Add clang format symlink" am: 9fc38629dc
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1510010

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: If0aabdfd37af4d3d128d592a0dbbcf275ed98663
2020-12-30 19:52:48 +00:00
Treehugger Robot 9fc38629dc Merge "lmkd: Add clang format symlink" 2020-12-30 19:38:28 +00:00
Suren Baghdasaryan e82fa8c9a0 lmkd: Handle workingset_refault vmstat field change in 5.9 kernel am: dc60f9717b am: fcebcf44c3
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1528739

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ifa11e51578b8ce4a96c18680360f51e3b902a0f3
2020-12-15 02:00:59 +00:00
Suren Baghdasaryan d689fdd8d4 lmkd: Remove unused workingset_refault parsing from zoneinfo am: 9f8d3dec72 am: a723c343d2
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1528738

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ic88201a020a6eda7fe905fd4ac1f3df0e89d6b15
2020-12-15 02:00:58 +00:00
Suren Baghdasaryan fcebcf44c3 lmkd: Handle workingset_refault vmstat field change in 5.9 kernel am: dc60f9717b
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1528739

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ic3a3a5292dcacca866c9a1ef973e644cc00f4aba
2020-12-15 01:50:59 +00:00
Suren Baghdasaryan a723c343d2 lmkd: Remove unused workingset_refault parsing from zoneinfo am: 9f8d3dec72
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1528738

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I57e18b751209779cf5f17ab784b54f2a7741129a
2020-12-15 01:50:58 +00:00
Suren Baghdasaryan dc60f9717b lmkd: Handle workingset_refault vmstat field change in 5.9 kernel
Linux kernel 5.9 change some vmstat fields including workingset_refault
which affects lmkd operation. Update vmstat parsing to handle both
old (workingset_refault) and new (workingset_refault_file) names for
that field.

Bug: 175617952
Test: lmkd_unit_test
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: I8f9b3d027ca96154f07e7252902a5aa04cf05a9f
2020-12-14 13:38:48 -08:00
Suren Baghdasaryan 9f8d3dec72 lmkd: Remove unused workingset_refault parsing from zoneinfo
workingset_refault field in zoneinfo is currently being parsed but
is not used. Instead the same field in vmstat is being used to
capture the number of file-backed workingset refaults. Remove the
unused field parsing code.

Bug: 175617952
Test: lmkd_unit_test
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: I79641a833c252cf50ac08c0c7d17c8294236d82d
2020-12-14 13:10:59 -08:00
Kalesh Singh 5015275acf lmkd: Add clang format symlink
Bug: 174144799
Test: clang-format -i <file>
Change-Id: I56afa2b58891fbc1786669afa7d442343dbc6f19
2020-11-24 13:09:01 -05:00
Xin Li 51ce688cf3 Mark ab/6881855 as merged am: 07acc19c82
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/memory/lmkd/+/13113095

Change-Id: I87d9d415c57bf723e40190c9e168fbdeeeb67ca7
2020-11-24 00:25:53 +00:00
Xin Li 07acc19c82 Mark ab/6881855 as merged
Bug: 172690556
Change-Id: I3f3d51c5ec32369ba0c31113822118d4bffe4147
2020-11-23 11:33:00 -08:00
Xin Li 7d88c39e7e [automerger skipped] Skip ab/6749736 in stage. am: e6ad9cc974 -s ours am: 5f53b6182a -s ours
am skip reason: Change-Id I21557b59bcb67736b552b7f5fa3b37045851a4dd with SHA-1 5ac19eb471 is in history

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

Change-Id: Ic0a4ce9ec9aacc805f9dafe2f3f5f8a58d04ec90
2020-10-09 04:17:56 +00:00
Xin Li 5f53b6182a [automerger skipped] Skip ab/6749736 in stage. am: e6ad9cc974 -s ours
am skip reason: Change-Id I21557b59bcb67736b552b7f5fa3b37045851a4dd with SHA-1 5ac19eb471 is in history

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

Change-Id: I48f4da311c68103df2f205d1127bb3470001e461
2020-10-09 03:39:58 +00:00
Xin Li e6ad9cc974 Skip ab/6749736 in stage.
Merged-In: I21557b59bcb67736b552b7f5fa3b37045851a4dd
Change-Id: I4ba2e0df4785cafd998a73ac73520c5ac06cc700
2020-10-08 17:24:04 -07:00
Sudarshan Rajagopalan b94cc1c4d3 libpsi: Export library to vendor am: c467601098 am: 54c3db5d70 am: 449b0f229f am: c9703e8e18
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1437955

Change-Id: I82b31efaf6b8347019fc934d154493a132cdec0d
2020-09-29 02:22:19 +00:00
Sudarshan Rajagopalan c9703e8e18 libpsi: Export library to vendor am: c467601098 am: 54c3db5d70 am: 449b0f229f
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1437955

Change-Id: I63af4bea59653360e6db2014f7d48b4478e03b48
2020-09-29 01:56:06 +00:00
Sudarshan Rajagopalan 449b0f229f libpsi: Export library to vendor am: c467601098 am: 54c3db5d70
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1437955

Change-Id: I59b45e92823d544f77c7dc207b0c836d2d56280d
2020-09-29 01:39:26 +00:00
Sudarshan Rajagopalan bfacb1cbdc libpsi: Add explicit header files am: 8771e054e8 am: 41dc0274a3 am: 21eb403400 am: 070fa2cc74
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1437956

Change-Id: Ia4fff3569217a00c5aab164c96ce8d617c09f97b
2020-09-29 01:39:06 +00:00
Sudarshan Rajagopalan 54c3db5d70 libpsi: Export library to vendor am: c467601098
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1437955

Change-Id: I71df63d382caf5f06131b1f7950dab1955bb6c4d
2020-09-29 01:21:07 +00:00
Sudarshan Rajagopalan 070fa2cc74 libpsi: Add explicit header files am: 8771e054e8 am: 41dc0274a3 am: 21eb403400
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1437956

Change-Id: I5ea35dba3983dbc8d62c5dae6065139753b7a586
2020-09-29 01:20:24 +00:00
Sudarshan Rajagopalan 21eb403400 libpsi: Add explicit header files am: 8771e054e8 am: 41dc0274a3
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1437956

Change-Id: I70265a45d7aed65c9341b91db8b26968a2de1fe2
2020-09-29 01:04:40 +00:00
Sudarshan Rajagopalan 41dc0274a3 libpsi: Add explicit header files am: 8771e054e8
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1437956

Change-Id: I7c68520392ec9aca5921dac5b372cbf011849800
2020-09-29 00:10:01 +00:00
Sudarshan Rajagopalan c467601098 libpsi: Export library to vendor
Make vendor_available = true so that other modules in vendor image
can leverage this library to init, register and unregister to psi.

Bug: 169346507
Change-Id: I47f7d25984e09d61703e7b2bd6fcb8db9d3814f5
Signed-off-by: Sudarshan Rajagopalan <sudaraja@codeaurora.org>
2020-09-28 14:51:09 -07:00
Sudarshan Rajagopalan 8771e054e8 libpsi: Add explicit header files
The libpsi source code is missing cutils and stdio header files.
Add cutils and stdio header files, and add libcutils_headers to
the header library in Android.bp.

Bug: 169346507
Change-Id: I2d613d5724d3c5f52dd52dcae7024439f2e8d5bb
Signed-off-by: Sudarshan Rajagopalan <sudaraja@codeaurora.org>
2020-09-28 14:50:15 -07:00
Suren Baghdasaryan fb80cee5c6 [automerger skipped] lmkd: report kill reason, and meminfo details to statsd for each kill am: 140385d3a0 -s ours
am skip reason: Change-Id Ic46aed3c85b880b32ac5ad61b55f90e0d33517c7 with SHA-1 3cc1f13044 is in history

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

Change-Id: Ifde6aafa26f0af2d605a42cbf046d5a598818341
2020-09-16 16:52:06 +00:00
Suren Baghdasaryan 140385d3a0 lmkd: report kill reason, and meminfo details to statsd for each kill
Information like free memory and swap as well as kill reason would be
useful for understanding regressions in the number of lmk kills in the
field.

Bug: 168117803
Test: statsd_testdrive 51, load with lmk_unit_test
Merged-In: Ic46aed3c85b880b32ac5ad61b55f90e0d33517c7
Change-Id: Ic46aed3c85b880b32ac5ad61b55f90e0d33517c7
2020-09-15 11:34:27 -07:00
Suren Baghdasaryan 272c650dd3 lmkd: report kill reason, and meminfo details to statsd for each kill am: 3cc1f13044 am: 595d1c19c7 am: f527dfc9df am: f50a9ebb36
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1424049

Change-Id: I68a21b58828399cebd58552870015974296e1445
2020-09-14 22:40:15 +00:00
Suren Baghdasaryan f50a9ebb36 lmkd: report kill reason, and meminfo details to statsd for each kill am: 3cc1f13044 am: 595d1c19c7 am: f527dfc9df
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1424049

Change-Id: Ic7aee07c12f089aac0c41ee25389331b154d70f6
2020-09-14 21:56:11 +00:00
Suren Baghdasaryan f527dfc9df lmkd: report kill reason, and meminfo details to statsd for each kill am: 3cc1f13044 am: 595d1c19c7
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1424049

Change-Id: I243c0a670ba02cc0762d0ea7f664d91afede2d9a
2020-09-14 21:24:45 +00:00
Suren Baghdasaryan 595d1c19c7 lmkd: report kill reason, and meminfo details to statsd for each kill am: 3cc1f13044
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1424049

Change-Id: Ic70e756c0ac793414c68967a7fe13599da7b0d7d
2020-09-14 17:32:25 +00:00
Suren Baghdasaryan 3cc1f13044 lmkd: report kill reason, and meminfo details to statsd for each kill
Information like free memory and swap as well as kill reason would be
useful for understanding regressions in the number of lmk kills in the
field.

Bug: 168117803
Change-Id: Ic46aed3c85b880b32ac5ad61b55f90e0d33517c7
Test: statsd_testdrive 51, load with lmk_unit_test
2020-09-11 14:24:23 +01:00
Martin Liu bb1a7d9b7a [automerger skipped] lmkd: fix possible long stall state am: d816ab7c54 -s ours
am skip reason: Change-Id I10c65c85b718a656e3d8991bf09948b96da895cb with SHA-1 589b5752ee is in history

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

Change-Id: I0ec6db70a9b5c69cb2fd463409f11f04639fca82
2020-09-08 06:51:00 +00:00
Martin Liu 74129d3d9e [automerger skipped] lmkd: avoid division by zero because of file_base_lru am: 91bf598282 -s ours
am skip reason: Change-Id If19dbbaafe6cd28a9d5b7f8a002f3cd33daab5e7 with SHA-1 c3108416e7 is in history

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

Change-Id: Ied58f07fa22194ca3a89017312140736c64c64f2
2020-09-08 06:50:56 +00:00
Martin Liu 14009f3ba7 [automerger skipped] lmkd: adjust thrashing dection strategy am: 94d99a7bc8 -s ours
am skip reason: Change-Id Ie9f4121ea604179c0ad510cc8430e7a6aec6e6b2 with SHA-1 1f72f5fa4b is in history

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

Change-Id: I6ff41029d3f4f4b153920101012454a513d1c375
2020-09-08 06:50:54 +00:00
Martin Liu 7a57924ce8 Revert "lmkd: Add a margin for watermark when swap free is low" am: cd5f08d8ee
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/memory/lmkd/+/12445404

Change-Id: I3056e7cf80a12a2245ce15cab325a9a6c75b006d
2020-09-08 06:50:53 +00:00
Martin Liu d816ab7c54 lmkd: fix possible long stall state
If the first PSI event triggers a kill, lmkd won't resume polling
immediately after the process has died. Instead, it will wait until the
next PSI event to resume the polling which is too late when the device
is under memory pressure. This happens if data communication with AMS
happens after previous polling window expired, in which case paused
handler gets reset and polling does not resume after the kill.
Fix this by changing pause handler reset logic.

Bug: 167562248
Test: memory pressure test
Signed-off-by: Martin Liu <liumartin@google.com>
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Merged-In: I10c65c85b718a656e3d8991bf09948b96da895cb
Change-Id: I10c65c85b718a656e3d8991bf09948b96da895cb
2020-09-07 10:46:16 +08:00
Martin Liu 91bf598282 lmkd: avoid division by zero because of file_base_lru
It seems we have chance that file_base_lru is zero.
Avoid it by adding 1.

Bug: 167660459
Bug: 163134367
Test: boot
Signed-off-by: Martin Liu <liumartin@google.com>
Merged-In: If19dbbaafe6cd28a9d5b7f8a002f3cd33daab5e7
Change-Id: If19dbbaafe6cd28a9d5b7f8a002f3cd33daab5e7
2020-09-07 10:43:24 +08:00