Commit Graph

953 Commits

Author SHA1 Message Date
Wei Wang 7bfd31e6e3 lmkd: use fd cache for cgroup migration am: 0162e0361f am: dbb9a69dc6 am: 022fa421c6
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1833054

Change-Id: I0405e4cf84706d15bf97fda53e8f5711943ca9f5
2021-09-22 18:59:48 +00:00
Wei Wang 022fa421c6 lmkd: use fd cache for cgroup migration am: 0162e0361f am: dbb9a69dc6
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1833054

Change-Id: I6e90cb69fb9e446239212737f8ef2643699b1360
2021-09-22 18:38:47 +00:00
Wei Wang dbb9a69dc6 lmkd: use fd cache for cgroup migration am: 0162e0361f
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1833054

Change-Id: Ie70f8800acdef24ccf8731215ce1b1cae8e01539
2021-09-22 18:27:25 +00:00
Wei Wang 0162e0361f lmkd: use fd cache for cgroup migration
Test: Build
Bug: 199797672
Signed-off-by: Wei Wang <wvw@google.com>
Change-Id: Ie7a9eb9676c58309f1407c5f8cc59b302f107d38
2021-09-21 14:38:49 -07:00
Suren Baghdasaryan d31d0d1eb2 [automerger skipped] lmkd: Do not re-initialize lmkd when persistent properties are loaded am: fcb9cb6de4 -s ours
am skip reason: Merged-In Iba34fc719a18d58b890549c7415bec869d471901 with SHA-1 0e64eadc21 is already in history

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

Change-Id: I414d3c898dd7503119e37f9e7ad2a601c51cbbba
2021-09-15 23:18:00 +00:00
Suren Baghdasaryan d941a3e7bb [automerger skipped] lmkd: Add support for persist.device_config.lmkd_native.* properties am: e7d82ee7e7 -s ours
am skip reason: Merged-In Ia48fd51eab126d307a1604530b642e86cf250688 with SHA-1 d0a800402c is already in history

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

Change-Id: Ice7ea4aac70782659cc2009cea1e6614b13d85a9
2021-09-15 23:17:59 +00:00
Wei Wang 193b84cd38 lmkd: migrate process to FOREGROUND sched group before kill am: 0195bcdba7 am: a95efc0941 am: 50bf1dc40c
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1825954

Change-Id: I73a62f67750c64f87739d64ea0ba3f9010b94f70
2021-09-14 15:13:34 +00:00
Wei Wang 50bf1dc40c lmkd: migrate process to FOREGROUND sched group before kill am: 0195bcdba7 am: a95efc0941
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1825954

Change-Id: I675954885ae62c41b441865dffc8ce9e65529146
2021-09-14 15:03:43 +00:00
Wei Wang a95efc0941 lmkd: migrate process to FOREGROUND sched group before kill am: 0195bcdba7
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1825954

Change-Id: I9b572a9786cf5b7a583730654facca0e30bf57bb
2021-09-14 14:48:51 +00:00
Wei Wang 0195bcdba7 lmkd: migrate process to FOREGROUND sched group before kill
BG group may have settings such as cpu.shares impacting reclaim
performance. Let us migrate task to foreground sched group similarly to
cpuset group.

Test: Build
Bug: 199797672
Signed-off-by: Wei Wang <wvw@google.com>
Change-Id: I75ee9f3486a2c76e65267a98e39edff96a5e1673
2021-09-13 19:07:26 -07:00
Suren Baghdasaryan fcb9cb6de4 lmkd: Do not re-initialize lmkd when persistent properties are loaded
When a device boots, lmkd starts before persistent properties are loaded,
therefore if experiments set any flags, the corresponding persistent
properties will trigger change notifications when they are first loaded
during boot.
In order to prevent lmkd from re-initializing on every property load,
mark persistent property change by setting lmkd.reinit to 0 and delay
lmkd re-initialization until sys.boot_completed=1 when all properties
are set and only one re-initialization will capture them all. On devices
with no experiment flags being set lmkd.reinit will be undefined at the
boot completion time and re-initialization will not be triggered at all.

Bug: 194316048
Test: adb shell device_config put lmkd_native thrashing_limit_critical 350
Test: adb shell device_config put lmkd_native thrashing_limit 100
Test: adb reboot; adb -b all logcat | grep lmkd
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: Iba34fc719a18d58b890549c7415bec869d471901
Merged-In: Iba34fc719a18d58b890549c7415bec869d471901
2021-09-09 15:11:08 -07:00
Suren Baghdasaryan e7d82ee7e7 lmkd: Add support for persist.device_config.lmkd_native.* properties
Allow persist.device_config.lmkd_native.* to override ro.lmk.*
properties to enable experiments with lmkd configuration properties.
Experiments will be able to set appropriate
persist.device_config.lmkd_native.<name> property which will issue
"lmkd --reinit" command to reinitialize lmkd with new parameters.

Bug: 194316048
Test: adb shell device_config put lmkd_native thrashing_limit_critical 350
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: Ia48fd51eab126d307a1604530b642e86cf250688
Merged-In: Ia48fd51eab126d307a1604530b642e86cf250688
2021-09-09 15:09:45 -07:00
Suren Baghdasaryan ca40541bfc lmkd: Do not re-initialize lmkd when persistent properties are loaded am: 0e64eadc21 am: e87dd04e20 am: 6ea9d83ddd
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1815756

Change-Id: Ic7fc8573cfa282340d19c5430b18ca0333628309
2021-09-02 00:33:32 +00:00
Suren Baghdasaryan 6ea9d83ddd lmkd: Do not re-initialize lmkd when persistent properties are loaded am: 0e64eadc21 am: e87dd04e20
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1815756

Change-Id: I275bb50a28e949971d44b36c4133763200acce73
2021-09-02 00:18:56 +00:00
Suren Baghdasaryan e87dd04e20 lmkd: Do not re-initialize lmkd when persistent properties are loaded am: 0e64eadc21
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1815756

Change-Id: I9862d501675abeec5f4306e111d148bcc7ae8fb9
2021-09-01 23:58:43 +00:00
Suren Baghdasaryan 0e64eadc21 lmkd: Do not re-initialize lmkd when persistent properties are loaded
When a device boots, lmkd starts before persistent properties are loaded,
therefore if experiments set any flags, the corresponding persistent
properties will trigger change notifications when they are first loaded
during boot.
In order to prevent lmkd from re-initializing on every property load,
mark persistent property change by setting lmkd.reinit to 0 and delay
lmkd re-initialization until sys.boot_completed=1 when all properties
are set and only one re-initialization will capture them all. On devices
with no experiment flags being set lmkd.reinit will be undefined at the
boot completion time and re-initialization will not be triggered at all.

Bug: 194316048
Test: adb shell device_config put lmkd_native thrashing_limit_critical 350
Test: adb shell device_config put lmkd_native thrashing_limit 100
Test: adb reboot; adb -b all logcat | grep lmkd
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: Iba34fc719a18d58b890549c7415bec869d471901
2021-09-01 00:56:35 -07:00
Suren Baghdasaryan deb55f8395 lmkd: Add support for persist.device_config.lmkd_native.* properties am: d0a800402c am: c51f018a6d am: 345fb264a4
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1785437

Change-Id: Ib92c5fa0fb55359762419021c1de551b68ffdc55
2021-08-31 20:12:10 +00:00
Suren Baghdasaryan 345fb264a4 lmkd: Add support for persist.device_config.lmkd_native.* properties am: d0a800402c am: c51f018a6d
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1785437

Change-Id: I370b9988d5d94b56069c59656dd47e9f96c0546b
2021-08-31 20:03:28 +00:00
Suren Baghdasaryan c51f018a6d lmkd: Add support for persist.device_config.lmkd_native.* properties am: d0a800402c
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1785437

Change-Id: Ib77d4ce588ec31631e6721130ea0a163afe83bed
2021-08-31 19:52:44 +00:00
Suren Baghdasaryan d0a800402c lmkd: Add support for persist.device_config.lmkd_native.* properties
Allow persist.device_config.lmkd_native.* to override ro.lmk.*
properties to enable experiments with lmkd configuration properties.
Experiments will be able to set appropriate
persist.device_config.lmkd_native.<name> property which will issue
"lmkd --reinit" command to reinitialize lmkd with new parameters.

Bug: 194316048
Test: adb shell device_config put lmkd_native thrashing_limit_critical 350
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: Ia48fd51eab126d307a1604530b642e86cf250688
2021-08-31 09:20:46 -07:00
Xin Li 6ef245e3f1 [automerger skipped] Mark sc-dev-plus-aosp-without-vendor@7634622 as merged am: 597d5d2b61 -s ours am: 18ecbf78ce -s ours
am skip reason: Merged-In I905d1733efec72c8e2745cff51cec0547ea57fea with SHA-1 e4689257db is already in history

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

Change-Id: Id107b539c97dad962d78aaecb833474975a74f4e
2021-08-14 06:42:20 +00:00
Xin Li 18ecbf78ce [automerger skipped] Mark sc-dev-plus-aosp-without-vendor@7634622 as merged am: 597d5d2b61 -s ours
am skip reason: Merged-In I905d1733efec72c8e2745cff51cec0547ea57fea with SHA-1 e4689257db is already in history

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

Change-Id: I59ff94ac3052c99c55017f8e2421d3424d8b5862
2021-08-14 06:29:57 +00:00
Xin Li 597d5d2b61 Mark sc-dev-plus-aosp-without-vendor@7634622 as merged
Merged-In: I905d1733efec72c8e2745cff51cec0547ea57fea
Change-Id: If3648949cabbd47830dabc09b8c293d3c2ee274b
2021-08-14 06:04:15 +00:00
Suren Baghdasaryan 93704f46a8 lmkd: Add thrashing and max_thrashing into killinfo reports am: 39b54809fb am: 145613c986 am: 31b3e7a5aa
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1790959

Change-Id: Ifebe0b2dd132eb629a3cf7f5f0cf691a27df58db
2021-08-12 02:40:56 +00:00
Suren Baghdasaryan 31b3e7a5aa lmkd: Add thrashing and max_thrashing into killinfo reports am: 39b54809fb am: 145613c986
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1790959

Change-Id: I76aec795719c4eec2eff0bb0b4b7c4f9a1d1e650
2021-08-12 02:26:14 +00:00
Suren Baghdasaryan 145613c986 lmkd: Add thrashing and max_thrashing into killinfo reports am: 39b54809fb
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1790959

Change-Id: Ia780dc3b3b96fdcbd48cb72dff62cf52d33c7a0d
2021-08-12 02:10:36 +00:00
Suren Baghdasaryan 39b54809fb lmkd: Add thrashing and max_thrashing into killinfo reports
Due to the increased importance of thrashing limits, include current and
max thrashing levels into killinfo reports.

Bug: 195979894
Test: lmkd_unit_test
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: I36f947e45e03a4d845d18881e137e4b242aacb65
2021-08-09 15:10:46 -07:00
George Burgess IV e4689257db lmkd: fix potential NULL pointer dereference am: e849f1414e am: 047e6e30e7
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1787727

Change-Id: I905d1733efec72c8e2745cff51cec0547ea57fea
2021-08-05 17:51:22 +00:00
George Burgess IV 047e6e30e7 lmkd: fix potential NULL pointer dereference am: e849f1414e
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1787727

Change-Id: I1b048df607f8503bcc93d68c44b061dfd148a2d2
2021-08-05 17:33:24 +00:00
George Burgess IV e849f1414e lmkd: fix potential NULL pointer dereference
`ki` appears to be potentially NULL. Output bogus values if it is.

Caught by the static analyzer:
> system/memory/lmkd/lmkd.cpp:2171:66: warning: Access to field
'kill_reason' results in a dereference of a null pointer (loaded from
variable 'ki') [clang-analyzer-core.NullDereference]

Bug: None
Test: TreeHugger
Change-Id: Iae26855528e1f7fec8f1455e06c7e813a732dc75
2021-08-05 06:59:42 +00:00
Suren Baghdasaryan dc2e03adf9 lmkd: Add a tracepoint for each kill with kill parameters am: 34928bb817 am: a2394fb247
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1782391

Change-Id: I80cdfcc2f323b16ea9f3518ac2b317be6c7b3f2a
2021-08-03 16:19:23 +00:00
Suren Baghdasaryan a2394fb247 lmkd: Add a tracepoint for each kill with kill parameters am: 34928bb817
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1782391

Change-Id: I805fa72d4784775bfc9c148a957417654a26d3c8
2021-08-03 16:04:54 +00:00
Suren Baghdasaryan 34928bb817 lmkd: Add a tracepoint for each kill with kill parameters
Add a trace for each kill that includes pid, kill reason, oom_adj_score,
min_oom_score and max_thrashing statistics at the time of the kill.

Bug: 195085238
Test: generate kills while tracing and observer the new tracepoints
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: Ic2014adc08f5e5dd4aacd415970332618bd15250
2021-07-30 12:59:15 -07:00
Suren Baghdasaryan 6deecd4aa5 [automerger skipped] lmkd: Add current and max thrashing levels in LMK_MEMORY_STATS reports am: e16047516d am: 74c1874aa2 -s ours
am skip reason: Merged-In I8a34dc41e7f03668bfad4ac2cbcb5d2570a10752 with SHA-1 81bb801dd2 is already in history

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

Change-Id: I2831e9f8024f7809373cb2d3499c112f5f125c51
2021-07-26 18:18:39 +00:00
Suren Baghdasaryan ee01679a16 [automerger skipped] Revert "lmkd: Disable critical thrashing limit by default" am: 1ef4718aed am: ccd7f3f735 -s ours
am skip reason: Merged-In I15be5b3d67a71b68bca6dea9c2d5b4aa54d6c260 with SHA-1 dded82877f is already in history

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

Change-Id: I0fe9b16c095298e4b9836f5e5b06d813f57e7f22
2021-07-26 18:18:38 +00:00
Suren Baghdasaryan 74c1874aa2 lmkd: Add current and max thrashing levels in LMK_MEMORY_STATS reports am: e16047516d
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1776906

Change-Id: Idf1f7e4011c25bf645eda165cc0604ff324597a7
2021-07-26 18:03:10 +00:00
Suren Baghdasaryan ccd7f3f735 Revert "lmkd: Disable critical thrashing limit by default" am: 1ef4718aed
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1776905

Change-Id: I813228ae2107df1ee31a18ffae4853e01bcad5fd
2021-07-26 18:03:09 +00:00
Suren Baghdasaryan 559c0d11a8 lmkd: Add current and max thrashing levels in LMK_MEMORY_STATS reports am: 81bb801dd2
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/memory/lmkd/+/15365195

Change-Id: If9fbee8fab4c2abf05ec288382deb9432f6ada6d
2021-07-23 21:42:14 +00:00
Suren Baghdasaryan e16047516d lmkd: Add current and max thrashing levels in LMK_MEMORY_STATS reports
Thrashing threshold tuning requires collecting thrashing level data from
the field and correlating these levels with other indications of device
being non-responsive.
Include current and max thrashing levels in the lmkd kill reports. Max
thrashing level captures the highest level seen since the last kill report.

Bug: 194433891
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: I8a34dc41e7f03668bfad4ac2cbcb5d2570a10752
Merged-In: I8a34dc41e7f03668bfad4ac2cbcb5d2570a10752
2021-07-23 19:11:36 +00:00
Suren Baghdasaryan 1ef4718aed Revert "lmkd: Disable critical thrashing limit by default"
This reverts commit e1ffef4e36.

Reason for revert: Restore the default thrashing limits to prevent unresponsive devices.

Bug: 194199500
Change-Id: I15be5b3d67a71b68bca6dea9c2d5b4aa54d6c260
Merged-In: I15be5b3d67a71b68bca6dea9c2d5b4aa54d6c260
2021-07-23 12:01:55 -07:00
Suren Baghdasaryan 81bb801dd2 lmkd: Add current and max thrashing levels in LMK_MEMORY_STATS reports
Thrashing threshold tuning requires collecting thrashing level data from
the field and correlating these levels with other indications of device
being non-responsive.
Include current and max thrashing levels in the lmkd kill reports. Max
thrashing level captures the highest level seen since the last kill report.

Bug: 194433891
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: I8a34dc41e7f03668bfad4ac2cbcb5d2570a10752
2021-07-22 16:51:46 -07:00
Suren Baghdasaryan d042af50d1 Revert "lmkd: Disable critical thrashing limit by default" am: dded82877f
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/memory/lmkd/+/15362664

Change-Id: I1bf0676d3bddbbb391da637931305a67bb38e46b
2021-07-22 23:14:16 +00:00
Suren Baghdasaryan dded82877f Revert "lmkd: Disable critical thrashing limit by default"
This reverts commit e1ffef4e36.

Reason for revert: Restore the default thrashing limits to prevent unresponsive devices.

Bug: 194199500
Change-Id: I15be5b3d67a71b68bca6dea9c2d5b4aa54d6c260
2021-07-22 21:01:14 +00:00
TreeHugger Robot 1cbd4a6ce4 [automerger skipped] Merge "lmkd: Add ro.lmk.filecache_min_kb property for min filecache watermark" into sc-dev am: 9d08f060ac -s ours
am skip reason: Merged-In I49ca4cd2f33b27fdbc432d9ce6944b1a1794b749 with SHA-1 11221d4062 is already in history

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

Change-Id: I449d797c0d420753d952bd8d28c20d53a3624278
2021-07-21 07:45:56 +00:00
TreeHugger Robot 9d08f060ac Merge "lmkd: Add ro.lmk.filecache_min_kb property for min filecache watermark" into sc-dev 2021-07-21 07:34:31 +00:00
Suren Baghdasaryan 05bf34f100 lmkd: Disable critical thrashing limit by default am: c1171394a3 am: 05a14bada0
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1773246

Change-Id: I9f326e632fbb8cda92b19f2b1cf91031fee5fc63
2021-07-20 21:28:33 +00:00
Suren Baghdasaryan 05a14bada0 lmkd: Disable critical thrashing limit by default am: c1171394a3
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1773246

Change-Id: I878ee527439b88c108d006feef6b491c6f8f5db3
2021-07-20 21:14:09 +00:00
Suren Baghdasaryan 1ef8e2f767 lmkd: Disable critical thrashing limit by default am: e1ffef4e36
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/memory/lmkd/+/15339915

Change-Id: I5614425c8b29377aae1fde3fa1e5dba910e85792
2021-07-20 19:35:27 +00:00
Suren Baghdasaryan c1171394a3 lmkd: Disable critical thrashing limit by default
Critical thrashing limit determines the balance between how much
thrashing should be tolerated before killing a perceptible app.
This threshold might differ between devices, therefore we disable
critical thrashing limit by default allowing each device to set it
individually. This is done to prevent excessive kills of perceptible
apps.

Bug: 194199500
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: Idd1715564c3727b09fcb0a109ab3d6bae9d0b99a
2021-07-20 18:12:22 +00:00
Suren Baghdasaryan e1ffef4e36 lmkd: Disable critical thrashing limit by default
Critical thrashing limit determines the balance between how much
thrashing should be tolerated before killing a perceptible app.
This threshold might differ between devices, therefore we disable
critical thrashing limit by default allowing each device to set it
individually. This is done to prevent excessive kills of perceptible
apps.

Bug: 194199500
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: Idd1715564c3727b09fcb0a109ab3d6bae9d0b99a
2021-07-20 18:06:43 +00:00