Martin Liu
237b55a8f0
lmkd: avoid division by zero because of file_base_lru am: c3108416e7 am: b1294d486f am: d2d14448f3 am: 6e9525ad51 am: 1023db6172
...
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1418831
Change-Id: I404cef9f4ed35f8cd0cb622775ce0e7079aaa821
2020-09-03 17:57:08 +00:00
Martin Liu
1023db6172
lmkd: avoid division by zero because of file_base_lru am: c3108416e7 am: b1294d486f am: d2d14448f3 am: 6e9525ad51
...
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1418831
Change-Id: I5be5af2eae1504066790dbbacb5e4c562da2d385
2020-09-03 17:18:16 +00:00
Martin Liu
6e9525ad51
lmkd: avoid division by zero because of file_base_lru am: c3108416e7 am: b1294d486f am: d2d14448f3
...
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1418831
Change-Id: Ic4287b1fb3ef6f7d0100a8e9ee0764b48ce77503
2020-09-03 17:05:46 +00:00
Martin Liu
d2d14448f3
lmkd: avoid division by zero because of file_base_lru am: c3108416e7 am: b1294d486f
...
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1418831
Change-Id: Ic74cc56e98ff9851cd30dfaa9906781b69834aae
2020-09-03 16:51:58 +00:00
Martin Liu
b1294d486f
lmkd: avoid division by zero because of file_base_lru am: c3108416e7
...
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1418831
Change-Id: I828d0765ce5c1bbb15451c37a49bc0b9fc26795e
2020-09-03 16:40:55 +00:00
Martin Liu
c3108416e7
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
Test: boot
Signed-off-by: Martin Liu <liumartin@google.com>
Change-Id: If19dbbaafe6cd28a9d5b7f8a002f3cd33daab5e7
2020-09-04 00:03:49 +08:00
Martin Liu
63fc9417fd
lmkd: adjust thrashing dection strategy am: 1f72f5fa4b am: 58f6be8f3c am: c587b2629c am: 21a6082a6a am: 4bbbe5ef20
...
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1414468
Change-Id: I054efe052555f80b6e7c20507c12037ee0703aab
2020-09-02 22:17:25 +00:00
Martin Liu
4bbbe5ef20
lmkd: adjust thrashing dection strategy am: 1f72f5fa4b am: 58f6be8f3c am: c587b2629c am: 21a6082a6a
...
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1414468
Change-Id: Ie57a1b9360b27873af9056d1bc286352c2762aa2
2020-09-02 21:35:02 +00:00
Martin Liu
21a6082a6a
lmkd: adjust thrashing dection strategy am: 1f72f5fa4b am: 58f6be8f3c am: c587b2629c
...
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1414468
Change-Id: Ie55859692029d3946bf35a3b9fcfe692d14a25da
2020-09-02 21:06:37 +00:00
Martin Liu
c587b2629c
lmkd: adjust thrashing dection strategy am: 1f72f5fa4b am: 58f6be8f3c
...
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1414468
Change-Id: Ia9dab97711dbf1133821c104c18f76cc440623aa
2020-09-02 20:45:51 +00:00
Martin Liu
58f6be8f3c
lmkd: adjust thrashing dection strategy am: 1f72f5fa4b
...
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1414468
Change-Id: If2c66c905e2c5e73a946d9d19fa98a2c07a6fdf4
2020-09-02 20:03:10 +00:00
Martin Liu
1f72f5fa4b
lmkd: adjust thrashing dection strategy
...
When a device is thrashing the file cache, workingset refaults can
grow slowly because of variant reasons. Current thrashing detection
mechanism could reset the thrashing counter frequently as it relies
on presence of reclaim activity, however refaults can keep increasing
even when the device is not actively reclaiming. In addition, the
thrashing counter gets reset when conditions require a kill but lmkd
could not find an eligible process to be killed. This is problematic
because when this happens thrashing is being ignored.
Use a fixed 1 sec periods to aggregate the thrashing counter. Also we
need to keep monitoring thrashing counter while retrying as someone
could release the memory to mitigate the thrashing. If thrashing
counter is greater than the limit at the end of the 1 sec period this
means lmkd failed to find an eligible process to kill. In this case
we store accumulated thrashing in case a new eligible process appears
until accumulated thrashing is less that the limit or we miss an
entire 1 sec window.
Bug: 163134367
Test: heavy loading launch
Signed-off-by: Martin Liu <liumartin@google.com>
Change-Id: Ie9f4121ea604179c0ad510cc8430e7a6aec6e6b2
2020-08-28 13:04:42 +08:00
Xin Li
f97e4d70ab
[automerger skipped] Mark Android R (rvc-dev-plus-aosp-without-vendor@6692709) as merged am: 3bf11e828b -s ours am: cf7c2bc357 -s ours am: 9d02029885 -s ours am: 40e1efe466 -s ours
...
am skip reason: Change-Id I06968623ad7ea99ee61c001e367d3892249ed3a6 with SHA-1 0b8b47057e is in history
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/memory/lmkd/+/12469988
Change-Id: I29a809cc2fdddf5130946c8d708f668dfdb77ba9
2020-08-27 20:13:39 +00:00
Xin Li
40e1efe466
[automerger skipped] Mark Android R (rvc-dev-plus-aosp-without-vendor@6692709) as merged am: 3bf11e828b -s ours am: cf7c2bc357 -s ours am: 9d02029885 -s ours
...
am skip reason: Change-Id I06968623ad7ea99ee61c001e367d3892249ed3a6 with SHA-1 0b8b47057e is in history
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/memory/lmkd/+/12469988
Change-Id: I017ba8c1ee09c39cdc7f47af5344e5b8088adf79
2020-08-27 19:25:43 +00:00
Xin Li
9d02029885
[automerger skipped] Mark Android R (rvc-dev-plus-aosp-without-vendor@6692709) as merged am: 3bf11e828b -s ours am: cf7c2bc357 -s ours
...
am skip reason: Change-Id I06968623ad7ea99ee61c001e367d3892249ed3a6 with SHA-1 0b8b47057e is in history
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/memory/lmkd/+/12469988
Change-Id: Id352b7228a9fd5bd3fd6bb83676f481e3cf4eb2b
2020-08-27 19:03:00 +00:00
Xin Li
cf7c2bc357
[automerger skipped] Mark Android R (rvc-dev-plus-aosp-without-vendor@6692709) as merged am: 3bf11e828b -s ours
...
am skip reason: Change-Id I06968623ad7ea99ee61c001e367d3892249ed3a6 with SHA-1 0b8b47057e is in history
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/memory/lmkd/+/12469988
Change-Id: I09a11542a03147798cf88c1c4740b08bbb3d397c
2020-08-27 18:34:16 +00:00
Xin Li
3bf11e828b
Mark Android R (rvc-dev-plus-aosp-without-vendor@6692709) as merged
...
Bug: 166295507
Merged-In: I06968623ad7ea99ee61c001e367d3892249ed3a6
Change-Id: I536b69290d787bf3fa7d060427bbea66d6570699
2020-08-27 09:44:21 -07:00
Martin Liu
8263d07fe3
lmkd: Add a margin for watermark when swap free is low am: 95551f816a am: 07c9ed14e3 am: 4ee5ebb86b
...
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/memory/lmkd/+/12361021
Change-Id: Ib3c424a8a218fbb31129b0441dbd9f2d1469d3fb
2020-08-14 14:45:51 +00:00
Martin Liu
af93ddb1f6
lmkd: Add a margin for watermark when swap free is low am: 95551f816a am: 0b55174ae7 am: 3c5de93553
...
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/memory/lmkd/+/12361021
Change-Id: I9f76e821417c3a95fb75ee54e5935fcd68f45020
2020-08-14 14:45:34 +00:00
Martin Liu
4ee5ebb86b
lmkd: Add a margin for watermark when swap free is low am: 95551f816a am: 07c9ed14e3
...
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/memory/lmkd/+/12361021
Change-Id: Ida5727f7dc98aa2af0b558af855136fd452d21f8
2020-08-14 14:34:26 +00:00
Martin Liu
3c5de93553
lmkd: Add a margin for watermark when swap free is low am: 95551f816a am: 0b55174ae7
...
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/memory/lmkd/+/12361021
Change-Id: I94b6183ffc011f72cdf34fba15673e50c8cc9f6b
2020-08-14 14:33:17 +00:00
Martin Liu
07c9ed14e3
lmkd: Add a margin for watermark when swap free is low am: 95551f816a
...
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/memory/lmkd/+/12361021
Change-Id: Iadbc1b44c4699b9a0a1f74edce25eb5817615f5c
2020-08-14 14:15:32 +00:00
Martin Liu
0b55174ae7
lmkd: Add a margin for watermark when swap free is low am: 95551f816a
...
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/memory/lmkd/+/12361021
Change-Id: I241e3dd3ffafded55f303e91b61ed0c6edadc272
2020-08-14 14:14:26 +00:00
Martin Liu
95551f816a
lmkd: Add a margin for watermark when swap free is low
...
When swap is depleted file cache thrashing might result in allocations
quickly pushing memory below low watermark and kswapd quickly pushing
it back above high watermark. In this situation free memory stays above
high watermark most of the time and lmkd during its periodic wake-ups
has low chance of detecting low memory conditions. Add a 15% margin
for high watermark which would allow lmkd to kill if swap is low,some
memory was reclaimed since the last wakeup and free memory is just
above the high watermark limit.
Bug: 163134367
Test: heavy loading launch
Signed-off-by: Martin Liu <liumartin@google.com>
Change-Id: I5694736b04bafcd13c01f4b51e242e2ac4ff55a8
2020-08-14 04:29:48 +00:00
Ioannis Ilkos
3bba4ddc3c
Emit swap size in the killed process' statsd atoms am: 279268a07f am: 30240af1f0 am: 4018f3e2d1 am: 6e31b19a94 am: d6bf19a8b2
...
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1398492
Change-Id: I493e49904bf9b4b07731fb730ffdd7f27ae3baae
2020-08-13 09:23:37 +00:00
Ioannis Ilkos
d6bf19a8b2
Emit swap size in the killed process' statsd atoms am: 279268a07f am: 30240af1f0 am: 4018f3e2d1 am: 6e31b19a94
...
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1398492
Change-Id: I02e5cba798f923e16462606ec0325e226ef52946
2020-08-13 09:05:02 +00:00
Ioannis Ilkos
6e31b19a94
Emit swap size in the killed process' statsd atoms am: 279268a07f am: 30240af1f0 am: 4018f3e2d1
...
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1398492
Change-Id: I48cb0b10ae6aa65abb7e1ba3ffdcbadb56f269ff
2020-08-13 08:48:40 +00:00
Ioannis Ilkos
4018f3e2d1
Emit swap size in the killed process' statsd atoms am: 279268a07f am: 30240af1f0
...
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1398492
Change-Id: I0d1856dc7b2b33437ee62a79e8dc49bec06368f1
2020-08-13 08:05:03 +00:00
Ioannis Ilkos
30240af1f0
Emit swap size in the killed process' statsd atoms am: 279268a07f
...
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1398492
Change-Id: I1a3e6a035e60cd15ff6723ffcdcdc6e01262ccc0
2020-08-13 07:51:07 +00:00
Ioannis Ilkos
279268a07f
Emit swap size in the killed process' statsd atoms
...
Changes:
- We are already reading /proc/pid/status to resolve the tgid. While we
are at it, also parse RSS and swap values.
- Use the RSS and swap values for non memcg builds when creating the
statsd outputs
- Given we already read RSS, remove the separate read of /proc/pid/statm
that used to get tasksize.
Bug: 163116785
Test: manual, out/host/linux-x86/bin/statsd_testdrive 51
Change-Id: I9d98b9ffe8be0b014bb09174ec9532382cae1f38
2020-08-12 20:24:56 +01:00
Suren Baghdasaryan
11e4fe0a57
[automerger skipped] lmkd: Add lmkd wakeup information into killinfo logs am: fa667edb56 am: 2c509d9073 -s ours am: 280b96ad4a -s ours
...
am skip reason: Change-Id I0356c27515132ff0dd309b59a8bf907acbd67cd8 with SHA-1 fa667edb56 is in history
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/memory/lmkd/+/12245884
Change-Id: I85fa199df2389cd2e02a541720e8f1106b5c2b78
2020-07-30 02:07:45 +00:00
Suren Baghdasaryan
5764ea6bd3
[automerger skipped] lmkd: Set default kill timeout to limit waits for uninterruptible processes am: dd8c2c181b am: 504a7cafc5 -s ours am: c063938c8d -s ours
...
am skip reason: Change-Id Ia280dc095df9ca8494278e0a75b976ed93fc04ae with SHA-1 dd8c2c181b is in history
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/memory/lmkd/+/12245883
Change-Id: I0ab97f1c638e2e284df8dda9172ac5f7a0b245a0
2020-07-30 02:07:43 +00:00
Suren Baghdasaryan
280b96ad4a
[automerger skipped] lmkd: Add lmkd wakeup information into killinfo logs am: fa667edb56 am: 2c509d9073 -s ours
...
am skip reason: Change-Id I0356c27515132ff0dd309b59a8bf907acbd67cd8 with SHA-1 fa667edb56 is in history
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/memory/lmkd/+/12245884
Change-Id: I9a089a64efd480fa9db148552dc89ef6d14c70cd
2020-07-30 02:03:03 +00:00
Suren Baghdasaryan
c063938c8d
[automerger skipped] lmkd: Set default kill timeout to limit waits for uninterruptible processes am: dd8c2c181b am: 504a7cafc5 -s ours
...
am skip reason: Change-Id Ia280dc095df9ca8494278e0a75b976ed93fc04ae with SHA-1 dd8c2c181b is in history
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/memory/lmkd/+/12245883
Change-Id: I3cbc899106a37001e4e09c6b0223086a43c96e00
2020-07-30 02:03:02 +00:00
Suren Baghdasaryan
243e5d19ed
[automerger skipped] lmkd: Add lmkd wakeup information into killinfo logs am: fa667edb56 -s ours am: 5ac19eb471 -s ours am: 19d9d66dc5 -s ours
...
am skip reason: Change-Id I0356c27515132ff0dd309b59a8bf907acbd67cd8 with SHA-1 d7b4fcb8a5 is in history
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/memory/lmkd/+/12245884
Change-Id: I8de72dac9497e24681892eb65980f52136003158
2020-07-30 02:00:35 +00:00
Suren Baghdasaryan
b8983a9a25
[automerger skipped] lmkd: Set default kill timeout to limit waits for uninterruptible processes am: dd8c2c181b -s ours am: 4a04afd997 -s ours am: d457698550 -s ours
...
am skip reason: Change-Id Ia280dc095df9ca8494278e0a75b976ed93fc04ae with SHA-1 7d1f4f0047 is in history
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/memory/lmkd/+/12245883
Change-Id: I4ea7257b23f70ce102e64c8675c383f4c3067471
2020-07-30 02:00:34 +00:00
Suren Baghdasaryan
19d9d66dc5
[automerger skipped] lmkd: Add lmkd wakeup information into killinfo logs am: fa667edb56 -s ours am: 5ac19eb471 -s ours
...
am skip reason: Change-Id I0356c27515132ff0dd309b59a8bf907acbd67cd8 with SHA-1 d7b4fcb8a5 is in history
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/memory/lmkd/+/12245884
Change-Id: Ic7c9677be9e1d64d1fa3eff622a8b7fc3d21baf2
2020-07-30 01:50:56 +00:00
Suren Baghdasaryan
d457698550
[automerger skipped] lmkd: Set default kill timeout to limit waits for uninterruptible processes am: dd8c2c181b -s ours am: 4a04afd997 -s ours
...
am skip reason: Change-Id Ia280dc095df9ca8494278e0a75b976ed93fc04ae with SHA-1 7d1f4f0047 is in history
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/memory/lmkd/+/12245883
Change-Id: Ie74c182c82187afebc3b5a83aea0b501a395826e
2020-07-30 01:50:54 +00:00
Suren Baghdasaryan
2c509d9073
lmkd: Add lmkd wakeup information into killinfo logs am: fa667edb56
...
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/memory/lmkd/+/12245884
Change-Id: I0e84d86642df4dc4097f01ab7f6f94ba441f3692
2020-07-30 01:43:30 +00:00
Suren Baghdasaryan
504a7cafc5
lmkd: Set default kill timeout to limit waits for uninterruptible processes am: dd8c2c181b
...
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/memory/lmkd/+/12245883
Change-Id: I65c4ef026b2118d09fd3d3cdd2ff5aab2bf66cd2
2020-07-30 01:43:29 +00:00
Suren Baghdasaryan
5ac19eb471
[automerger skipped] lmkd: Add lmkd wakeup information into killinfo logs am: fa667edb56 -s ours
...
am skip reason: Change-Id I0356c27515132ff0dd309b59a8bf907acbd67cd8 with SHA-1 d7b4fcb8a5 is in history
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/memory/lmkd/+/12245884
Change-Id: I21557b59bcb67736b552b7f5fa3b37045851a4dd
2020-07-30 01:41:43 +00:00
Suren Baghdasaryan
4a04afd997
[automerger skipped] lmkd: Set default kill timeout to limit waits for uninterruptible processes am: dd8c2c181b -s ours
...
am skip reason: Change-Id Ia280dc095df9ca8494278e0a75b976ed93fc04ae with SHA-1 7d1f4f0047 is in history
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/memory/lmkd/+/12245883
Change-Id: I72a2b3e18a4f8e29095150f9eeb7dd64c622281f
2020-07-30 01:41:40 +00:00
Suren Baghdasaryan
fa667edb56
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
Bug: 161955028
Bug: 162297751
Test: lmkd_unit_test
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: I0356c27515132ff0dd309b59a8bf907acbd67cd8
(cherry picked from commit d7b4fcb8a5 )
Signed-off-by: Martin Liu <liumartin@google.com>
Merged-In: I0356c27515132ff0dd309b59a8bf907acbd67cd8
2020-07-30 01:33:27 +00:00
Suren Baghdasaryan
f423f2f875
[automerger skipped] lmkd: Add property re-initialization support am: c4081918a7 am: 595be9465b -s ours
...
am skip reason: Change-Id Ic60331f3368f5a7fdfe09ad7d47c7ccf0a497685 with SHA-1 c4081918a7 is in history
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/memory/lmkd/+/11412857
Change-Id: I7a0c3504721900d474893f35fa341c4083faef7b
2020-07-28 19:16:49 +00:00
Suren Baghdasaryan
dd8c2c181b
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
Bug: 161955028
Bug: 162297751
Test: lmkd_unit_test
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: Ia280dc095df9ca8494278e0a75b976ed93fc04ae
(cherry picked from commit 7d1f4f0047 )
Signed-off-by: Martin Liu <liumartin@google.com>
Merged-In: Ia280dc095df9ca8494278e0a75b976ed93fc04ae
2020-07-28 09:13:44 +00:00
Suren Baghdasaryan
3151fe6f17
lmkd: Add lmkd wakeup information into killinfo logs am: d7b4fcb8a5 am: 403c7fd536 am: 48f7d0e49f am: c7c600c768 am: c2cd36c35c
...
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1371804
Change-Id: I66f990d47b9cd369744b576c30f351e239a1fba5
2020-07-26 18:34:54 +00:00
Suren Baghdasaryan
c2cd36c35c
lmkd: Add lmkd wakeup information into killinfo logs am: d7b4fcb8a5 am: 403c7fd536 am: 48f7d0e49f am: c7c600c768
...
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1371804
Change-Id: Ic747bddb3936cf3f6e58705ea65b238d92402cc6
2020-07-26 18:19:48 +00:00
Suren Baghdasaryan
c7c600c768
lmkd: Add lmkd wakeup information into killinfo logs am: d7b4fcb8a5 am: 403c7fd536 am: 48f7d0e49f
...
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1371804
Change-Id: Ied2bb909d79ae865982795db181824a85bcf887c
2020-07-26 18:06:59 +00:00
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