Commit Graph

902 Commits

Author SHA1 Message Date
Suren Baghdasaryan e499b231a5 lmkd: Add ro.lmk.filecache_min_kb property for min filecache watermark am: 11221d4062 am: 47fc8fc026
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1766838

Change-Id: I004c501da601d7e5020e921d85326f80a3d2ba29
2021-07-16 16:55:22 +00:00
Suren Baghdasaryan 47fc8fc026 lmkd: Add ro.lmk.filecache_min_kb property for min filecache watermark am: 11221d4062
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1766838

Change-Id: I7ba3f64ccf9bbe2a4125c563697b4c9498659f16
2021-07-16 16:39:35 +00:00
Suren Baghdasaryan 11221d4062 lmkd: Add ro.lmk.filecache_min_kb property for min filecache watermark
We see many cases when device keeps thrashing despite lmkd kills. This
happens because killed processes do not free enough filecache to fit
the current workingset completely.
To prevent such cases, introduce ro.lmk.filecache_min_kb property to
specify min filecache size in KB that should be reached after thrashing
is detected. Lmkd will keep killing background processes until this
filecache size limit is satisfied.

Bug: 193293513
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: I49ca4cd2f33b27fdbc432d9ce6944b1a1794b749
2021-07-15 11:05:09 -07:00
Bill Yi 414187f3e7 [automerger skipped] Merge RQ3A.210705.001 to aosp-master - DO NOT MERGE am: af5221c0aa -s ours am: bb644e429d -s ours
am skip reason: Merged-In Ie5a50c392ef5124a0c2390c8d4f902808d672739 with SHA-1 4571e22641 is already in history

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

Change-Id: I2115de4b4c22260f0b89ef6fc65a5855a4d22889
2021-07-13 01:21:32 +00:00
Bill Yi bb644e429d [automerger skipped] Merge RQ3A.210705.001 to aosp-master - DO NOT MERGE am: af5221c0aa -s ours
am skip reason: Merged-In Ie5a50c392ef5124a0c2390c8d4f902808d672739 with SHA-1 4571e22641 is already in history

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

Change-Id: Ie6aa987914131dc840a522707f0492e88e2dfc1c
2021-07-13 01:02:57 +00:00
Bill Yi af5221c0aa Merge RQ3A.210705.001 to aosp-master - DO NOT MERGE
Merged-In: Ie5a50c392ef5124a0c2390c8d4f902808d672739
Merged-In: I89b3edde09dfcf35b8214fecbed18ce5092701cc
Merged-In: I89b3edde09dfcf35b8214fecbed18ce5092701cc
Change-Id: I25eccb8109695125480f0da0e136ab98dabfaa0d
2021-07-12 11:08:30 -07:00
Bill Yi f3a348d82f [automerger skipped] Merge RQ3A.210705.001 to stage-aosp-master - DO NOT MERGE am: 3e0118d834 -s ours
am skip reason: Merged-In I19b3c21e31e1ea4750e3e185474e82d0ed04f9a7 with SHA-1 ba6f7e4a74 is already in history

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

Change-Id: I5e671dd7acafbc61af958240b1109c8c354f17ed
2021-07-12 13:27:13 +00:00
Bill Yi 3e0118d834 Merge RQ3A.210705.001 to stage-aosp-master - DO NOT MERGE
Merged-In: I89b3edde09dfcf35b8214fecbed18ce5092701cc
Merged-In: I19b3c21e31e1ea4750e3e185474e82d0ed04f9a7
Change-Id: I9234fbd1f3434582615e56f662b76aa67a506d7d
2021-07-11 22:43:43 -07:00
Xin Li ba6f7e4a74 [automerger skipped] DO NOT MERGE - Mark RQ3A.210410.001 as merged am: 4571e22641 -s ours
am skip reason: Merged-In Ibd98f113f81a4f699b11dbc843a95ee2e2197c92 with SHA-1 e0d6203d39 is already in history

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

Change-Id: I19b3c21e31e1ea4750e3e185474e82d0ed04f9a7
2021-06-18 06:19:00 +00:00
Xin Li 4571e22641 DO NOT MERGE - Mark RQ3A.210410.001 as merged
Bug: 190855093
Merged-In: Ibd98f113f81a4f699b11dbc843a95ee2e2197c92
Change-Id: Ie5a50c392ef5124a0c2390c8d4f902808d672739
2021-06-17 22:43:30 -07:00
Suren Baghdasaryan 0e61541dfe [automerger skipped] lmkd: Include total GPU memory usage in killinfo reports am: a01f251ff2 -s ours
am skip reason: Merged-In Icc1ed8ab2593530fa293ff9c82f6c8dc400485f5 with SHA-1 940e7cf8bd is already in history

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

Change-Id: Ib66f41abf2b9057b66fc26c07fe33fa5567a9cd3
2021-06-16 20:42:47 +00:00
Suren Baghdasaryan a01f251ff2 lmkd: Include total GPU memory usage in killinfo reports
/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
2021-06-16 15:53:07 +00:00
Suren Baghdasaryan 740eb4cb91 Merge "lmkd: Include total GPU memory usage in killinfo reports" am: cde0acde94 am: e0d6203d39
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1721873

Change-Id: I0598e65644067a04f5068d374c98dd5482571c79
2021-06-15 02:02:44 +00:00
Suren Baghdasaryan e0d6203d39 Merge "lmkd: Include total GPU memory usage in killinfo reports" am: cde0acde94
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1721873

Change-Id: Ibd98f113f81a4f699b11dbc843a95ee2e2197c92
2021-06-15 01:49:40 +00:00
Suren Baghdasaryan cde0acde94 Merge "lmkd: Include total GPU memory usage in killinfo reports" 2021-06-15 01:33:14 +00:00
Xin Li 61e2948e80 DO NOT MERGE - Merge ab/7272582 am: b494068d81 am: 7b42292af3
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1736156

Change-Id: I4b76aa439db36731a599125341100d9f81f0fdb4
2021-06-13 23:30:38 +00:00
Xin Li 7b42292af3 DO NOT MERGE - Merge ab/7272582 am: b494068d81
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1736156

Change-Id: I94c864786f2d51e5f265921fa1a332ba6443a9ac
2021-06-13 23:13:21 +00:00
Xin Li b494068d81 DO NOT MERGE - Merge ab/7272582
Bug: 190855093
Change-Id: I42de6c44d675f5acc076df33083f8fe87da7031a
2021-06-11 17:33:57 -07:00
Suren Baghdasaryan 940e7cf8bd lmkd: Include total GPU memory usage in killinfo reports
/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
2021-06-03 15:56:52 -07:00
android-build-team Robot 1ff19f401f Merge cherrypicks of [14651914, 14651880, 14651759, 14652210, 14651594, 14651881, 14651915, 14651882, 14651883, 14651799, 14652154, 14651595, 14651760, 14652271, 14652272, 14652273, 14652056, 14651800, 14651801, 14651802, 14651884, 14651885, 14651886, 14652274, 14652275, 14652276, 14652277, 14652278, 14651894, 14651723, 14652211, 14651895, 14651916, 14651887, 14651888, 14651596, 14651889, 14652212, 14651761, 14652310, 14652311, 14651973, 14651974, 14652312, 14652313, 14651896, 14651803] into rvc-qpr3-release
Change-Id: I559773c77635b6480d054ba0daba281eef4f84a5
2021-05-20 00:04:50 +00:00
Suren Baghdasaryan ffce101d86 lmkd: Handle cases when proc_get_name() might return NULL
proc_get_name() can return NULL if the corresponding process has died
or open fails with ENOMEM due to memory shortages.
Ensure such cases are handled without NULL pointer access.

Bug: 186157675
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: I05b288e3808bec0bdb73db32de02ba3a322ca6e1
(cherry picked from commit e5995b8269)
2021-05-20 00:02:07 +00:00
Suren Baghdasaryan 3eaa6dbd6b lmkd: Handle cases when proc_get_name() might return NULL am: e5995b8269 am: b928e5d6ec am: 449e1017e1
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/memory/lmkd/+/14297833

Change-Id: Ieb50968b6823cafa09ab8524bfebd5d15716bc9b
2021-05-14 23:11:04 +00:00
Suren Baghdasaryan 449e1017e1 lmkd: Handle cases when proc_get_name() might return NULL am: e5995b8269 am: b928e5d6ec
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/memory/lmkd/+/14297833

Change-Id: Id82515f2cfe0e98d8dd6ad419c2544941642404a
2021-05-14 22:49:07 +00:00
Suren Baghdasaryan b928e5d6ec lmkd: Handle cases when proc_get_name() might return NULL am: e5995b8269
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/memory/lmkd/+/14297833

Change-Id: Ib6bbcb1c14669730e7896ac024dadc5bd4837283
2021-05-14 22:31:25 +00:00
Vova Sharaienko 482300d472 [automerger skipped] lmkd: reroute atoms logging to AMS am: a92b76b54d am: ea85216d08 am: 94be9d6516 -s ours am: 4e810afb15 -s ours
am skip reason: Merged-In Id682a438c87b3e4503261d26461f6cee641d86c4 with SHA-1 6f11aff418 is already in history

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

Change-Id: I168cb5ddd03bf5cdca1fecaa684b7ed922d8b903
2021-05-11 18:18:59 +00:00
Vova Sharaienko 4e810afb15 [automerger skipped] lmkd: reroute atoms logging to AMS am: a92b76b54d am: ea85216d08 am: 94be9d6516 -s ours
am skip reason: Merged-In Id682a438c87b3e4503261d26461f6cee641d86c4 with SHA-1 6f11aff418 is already in history

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

Change-Id: Ie1006f13729e16b267a5819c8d665b4b2645fd9d
2021-05-11 18:14:21 +00:00
Vova Sharaienko 94be9d6516 lmkd: reroute atoms logging to AMS am: a92b76b54d am: ea85216d08
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1702386

Change-Id: Ie377b3e52d0ec3175dc81b3c765ab2bf39b0dc15
2021-05-11 18:04:07 +00:00
Vova Sharaienko ea85216d08 lmkd: reroute atoms logging to AMS am: a92b76b54d
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1702386

Change-Id: Ibfac12827098eac2ab2789c876a688da73d0cd87
2021-05-11 17:42:46 +00:00
Vova Sharaienko a92b76b54d lmkd: reroute atoms logging to AMS
- 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
Merged-In: Id682a438c87b3e4503261d26461f6cee641d86c4
2021-05-11 00:00:56 +00:00
Vova Sharaienko 45fa6a05cb lmkd: reroute atoms logging to AMS am: 6f11aff418
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/memory/lmkd/+/14313337

Change-Id: Ib2853c76fbdd6c427b657b79c03a5499fc64a43c
2021-05-10 23:46:10 +00:00
Vova Sharaienko 6f11aff418 lmkd: reroute atoms logging to AMS
- 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
2021-05-03 21:47:22 +00:00
Suren Baghdasaryan 1174827c4d lmkd: Do not treat RSS=0 as a sign of a process being dead am: 5263aa7800 am: 8aec07bbe0 am: 28164d3cc6 am: 918648b001
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1690656

Change-Id: I5b38c0bbf186df02c2679a619fce20af02303b12
2021-04-30 02:38:43 +00:00
Suren Baghdasaryan 918648b001 lmkd: Do not treat RSS=0 as a sign of a process being dead am: 5263aa7800 am: 8aec07bbe0 am: 28164d3cc6
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1690656

Change-Id: Id8369cec0cbd39e4895e24eeffe824506fd3fb13
2021-04-30 01:40:22 +00:00
Suren Baghdasaryan 28164d3cc6 lmkd: Do not treat RSS=0 as a sign of a process being dead am: 5263aa7800 am: 8aec07bbe0
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1690656

Change-Id: Id59a056468b053d2c28206959d8295937c9788e1
2021-04-30 00:59:58 +00:00
Suren Baghdasaryan 8aec07bbe0 lmkd: Do not treat RSS=0 as a sign of a process being dead am: 5263aa7800
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1690656

Change-Id: I785575f6428b89bb59df690828fb60dc73f7d6e7
2021-04-30 00:35:22 +00:00
Suren Baghdasaryan 5263aa7800 lmkd: Do not treat RSS=0 as a sign of a process being dead
With kernel SPLIT_RSS_COUNTING feature it is possible for a valid
process to report RSS of 0 size when reading /proc/pid/statm. This
happens because split RSS accounting aggregates per-thread counters
asynchronously and depending on the timing of the read, reported
value can be inaccurate and occasionally be 0.
lmkd currently treats processes reporting RSS of 0 as dead and
removes them from the list of processes being tracked. This might
lead to a valid process becoming unkillable.
Change lmkd to stop treating RSS of 0 as a sign of a dead process.

Bug: 160199622
Test: set ro.lmk.kill_heaviest_task=true and hack kernel to report RSS=0
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: Ia311d2f98649c92d1a487657f94ea51f57813b73
2021-04-29 15:33:06 -07:00
Suren Baghdasaryan e67d7be9e4 lmkd: Handle cases when proc_get_name() might return NULL am: 9f1be12b9a am: d7838b8e06 am: c30dd665ba
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1685347

Change-Id: I0b430aeda1892a8916ac2538824496b0132c551e
2021-04-23 23:48:05 +00:00
Suren Baghdasaryan c30dd665ba lmkd: Handle cases when proc_get_name() might return NULL am: 9f1be12b9a am: d7838b8e06
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1685347

Change-Id: I0ee304f6d85704ffdfe7868379a2dfe5ab28c22e
2021-04-23 23:25:43 +00:00
Suren Baghdasaryan d7838b8e06 lmkd: Handle cases when proc_get_name() might return NULL am: 9f1be12b9a
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1685347

Change-Id: I048051fbbcf880642206e0a219171e7474fc677d
2021-04-23 23:04:06 +00:00
Suren Baghdasaryan e5995b8269 lmkd: Handle cases when proc_get_name() might return NULL
proc_get_name() can return NULL if the corresponding process has died
or open fails with ENOMEM due to memory shortages.
Ensure such cases are handled without NULL pointer access.

Bug: 186157675
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: I05b288e3808bec0bdb73db32de02ba3a322ca6e1
2021-04-23 21:18:35 +00:00
Suren Baghdasaryan 9f1be12b9a lmkd: Handle cases when proc_get_name() might return NULL
proc_get_name() can return NULL if the corresponding process has died
or open fails with ENOMEM due to memory shortages.
Ensure such cases are handled without NULL pointer access.

Bug: 186157675
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: I05b288e3808bec0bdb73db32de02ba3a322ca6e1
2021-04-23 21:18:18 +00:00
android-build-team Robot 547707cc2e Snap for 7269201 from e68bfe9a73 to rvc-qpr3-release
Change-Id: I4121184ff7bb28e9ee2d7e029d6d875833c46504
2021-04-08 22:07:02 +00:00
Suren Baghdasaryan 3fc2bcd6ad [automerger skipped] lmkd: Allow lmkd to kill perceptible apps during heavy thrashing am: e68bfe9a73 -s ours am: 0107f3c655 -s ours
am skip reason: skip tag Change-Id Icb38ef6c90adaa4f5c956593b6ea0c4febc91dc0 with SHA-1 0142b3c166 is already in history

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

Change-Id: I166723399de996ccfcd2eececd6ad8bc7ae557e7
2021-04-08 06:20:01 +00:00
Suren Baghdasaryan 09a988ee63 [automerger skipped] lmkd: choose the heaviest task when killing perceptible processes am: 720abce177 -s ours am: c5bc8cb7fa -s ours
am skip reason: skip tag Change-Id I775ff774430b6fde4d619ede794825dbae59fd8e with SHA-1 858e8c6373 is already in history

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

Change-Id: Ib28ff7ce4e4b7f20b2fb6758b9d50320d6d9afad
2021-04-08 06:20:01 +00:00
Suren Baghdasaryan 0107f3c655 [automerger skipped] lmkd: Allow lmkd to kill perceptible apps during heavy thrashing am: e68bfe9a73 -s ours
am skip reason: skip tag Change-Id Icb38ef6c90adaa4f5c956593b6ea0c4febc91dc0 with SHA-1 0142b3c166 is already in history

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

Change-Id: Ic33eb574acd23965cb6f7742ccc2093b3e0033b3
2021-04-08 05:52:00 +00:00
Suren Baghdasaryan c5bc8cb7fa [automerger skipped] lmkd: choose the heaviest task when killing perceptible processes am: 720abce177 -s ours
am skip reason: skip tag Change-Id I775ff774430b6fde4d619ede794825dbae59fd8e with SHA-1 858e8c6373 is already in history

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

Change-Id: I38ceae15c85ab3e02f4bb3e25d88729ed779406e
2021-04-08 05:51:59 +00:00
Suren Baghdasaryan e68bfe9a73 lmkd: Allow lmkd to kill perceptible apps during heavy thrashing
Occasionally a system can get into heavy file cache thrashing situation
and become unresponsive. In these situations we observe lmkd wakeups,
however it does not kill because all non-perceptible apps are already
killed and the system manages to reclaim enough memory to stay above
min watermark.
Add ro.lmk.thrashing_limit_critical property which when breached will
allow lmkd to kill perceptible apps. The property represents the
percentage of refaulted workingset pages as a fraction of overall file
cache size. By default it is disabled.

Bug: 181778155
Test: thrashing.py 500 10 200
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Merged-In: Icb38ef6c90adaa4f5c956593b6ea0c4febc91dc0
Change-Id: Icb38ef6c90adaa4f5c956593b6ea0c4febc91dc0
2021-04-07 11:55:04 +08:00
Suren Baghdasaryan 720abce177 lmkd: choose the heaviest task when killing perceptible processes
When killing a task at or lower than oom_score_adj PERCEPTIBLE_APP_ADJ
choose the heaviest task among the ones at that level to try minimizing
the number of required kills. Because killing a perceptible app will
affect user experience anyway, it makes sense to choose the one that
will release the most memory and therefore no more kills might be
necessary.

Bug: 181778155
Test: running thrashing.py script
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Merged-In: I775ff774430b6fde4d619ede794825dbae59fd8e
Change-Id: I775ff774430b6fde4d619ede794825dbae59fd8e
2021-04-07 11:50:57 +08:00
Suren Baghdasaryan dff35b7973 lmkd: Allow lmkd to kill perceptible apps during heavy thrashing am: 0142b3c166 am: 7ccd2c10ee am: eb09287574
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1653491

Change-Id: I993499fa1c3b3fc8e0ff278ea31df8ff9c606af7
2021-03-31 21:18:13 +00:00
Suren Baghdasaryan eb09287574 lmkd: Allow lmkd to kill perceptible apps during heavy thrashing am: 0142b3c166 am: 7ccd2c10ee
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1653491

Change-Id: I3bd353b448a3a6f886805704d64ffd23bc8f46a4
2021-03-31 20:32:29 +00:00