Xin Li
dda11a6d3d
Merge "Merge tm-qpr-dev-plus-aosp-without-vendor@9129937" into stage-aosp-master
2022-10-11 17:39:53 +00:00
Suren Baghdasaryan
7f8da1ec36
lmkd: remove priority setting for the kill target am: 67c467d4ec
...
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/2241693
Change-Id: Ibfb05c983d6bdd5be079f7705330377dbb095472
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-10-10 23:41:01 +00:00
Suren Baghdasaryan
c6753329a2
lmkd: measure free swap as available and easily reclaimable memory am: 495db5c643
...
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/2233052
Change-Id: I6436a866b2043a35c624c19ac705fe145e8b7e15
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-10-10 21:56:51 +00:00
Suren Baghdasaryan
67c467d4ec
lmkd: remove priority setting for the kill target
...
Setting cpusets and priorities for the kill target involves fs operations
which can block on kernel internal locks. Doing that from lmkd main thread
context has the danger of blocking lmkd. With the introduction of the
reaper threads the time for the target to exit is not as critical since
its memory is freed by the reaper thread.
To prevent lmkd from being blocked, move setting cpuset for the kill
target into the reaper thread and remove priority setting logic with
heavy use of procfs reads.
Bug: 238495258
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: I5defc6baa4ff1425d9835371b47a64e375ebac10
2022-10-10 17:47:40 +00:00
Xin Li
d53b1adb0f
Merge tm-qpr-dev-plus-aosp-without-vendor@9129937
...
Bug: 248070379
Merged-In: I0c7776aea1518c17f0a29904a44b7fe8f33980ca
Change-Id: I72fdb741d2564e56911d776a7bb446743c8124a3
2022-10-06 12:03:37 -07:00
Suren Baghdasaryan
495db5c643
lmkd: measure free swap as available and easily reclaimable memory
...
In the case of ZRAM, SwapFree does not represent the actual free swap
amount because swap space is taken from the free memory or reclaimed.
Therefore use free memory and easily reclaimable memory as an
approximation of how much free swap system can use. Use SwapFree as
a measure of how much swap space the system will consider using. Min
of those two measurements is used to decide how much usable swap the
system still has.
Bug: 238495258
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: Ia7b0cc4a744d14c0d6e52603795917cf5824ea15
2022-10-04 12:53:23 -07:00
Suren Baghdasaryan
d8a63ca13d
lmkd: Fix UAF caused by calling pid_remove() from the watchdog thread am: a3802f16cf
...
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/memory/lmkd/+/20081396
Change-Id: Ibd250d0d2ec7a98a91b975f3e272c97ed620fc5d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-09-30 00:45:05 +00:00
Suren Baghdasaryan
7f8c6edb33
lmkd: Fix UAF caused by calling pid_remove() from the watchdog thread am: ba9ea6e3d6 am: d5dbec8d23 am: 02af677a49 am: 6057c60d5b
...
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/2235075
Change-Id: Ia3924dc82ffcd6dee53e22f8dcb6e45d2eee6e83
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-09-29 20:09:40 +00:00
Suren Baghdasaryan
6057c60d5b
lmkd: Fix UAF caused by calling pid_remove() from the watchdog thread am: ba9ea6e3d6 am: d5dbec8d23 am: 02af677a49
...
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/2235075
Change-Id: I166f3e4f03e886d5a6d9c684267ac46ec1f9d698
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-09-29 19:43:01 +00:00
Suren Baghdasaryan
02af677a49
lmkd: Fix UAF caused by calling pid_remove() from the watchdog thread am: ba9ea6e3d6 am: d5dbec8d23
...
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/2235075
Change-Id: I142a550c5c52a2bb62bcc19a3b9d6112f403efac
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-09-29 18:38:52 +00:00
Suren Baghdasaryan
d5dbec8d23
lmkd: Fix UAF caused by calling pid_remove() from the watchdog thread am: ba9ea6e3d6
...
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/2235075
Change-Id: I6c720544601c84096a70f9e06d96a46f8973768b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-09-29 18:09:27 +00:00
Suren Baghdasaryan
a3802f16cf
lmkd: Fix UAF caused by calling pid_remove() from the watchdog thread
...
pid_remove() is not a thread-safe function and can be called only from
the main thread. Calling it from the watchdog_callback() executed in the
context of the watchdog thread can cause a use-after-free failure if the
same record is being used by the main thread. Fix this issue by marking
the process record as invalid instead of destroying it. Later on invalid
records will be cleared in kill_one_process() called from the context of
the main thread.
Fixes: f8727745f9 ("lmkd: Remove process record after it is killed by lmkd watchdog")
Bug: 248448498
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: I0c7776aea1518c17f0a29904a44b7fe8f33980ca
2022-09-29 17:47:31 +00:00
Suren Baghdasaryan
ba9ea6e3d6
lmkd: Fix UAF caused by calling pid_remove() from the watchdog thread
...
pid_remove() is not a thread-safe function and can be called only from
the main thread. Calling it from the watchdog_callback() executed in the
context of the watchdog thread can cause a use-after-free failure if the
same record is being used by the main thread. Fix this issue by marking
the process record as invalid instead of destroying it. Later on invalid
records will be cleared in kill_one_process() called from the context of
the main thread.
Fixes: f8727745f9 ("lmkd: Remove process record after it is killed by lmkd watchdog")
Bug: 248448498
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: I0c7776aea1518c17f0a29904a44b7fe8f33980ca
2022-09-27 14:30:34 -07:00
Suren Baghdasaryan
d49a7e77b3
lmkd: Remove process record after it is killed by lmkd watchdog am: 26c9de4e72
...
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/memory/lmkd/+/19748193
Change-Id: I702b7374187ae4916cd6b10110b4bc2573989d5b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-08-26 19:43:36 +00:00
Suren Baghdasaryan
26c9de4e72
lmkd: Remove process record after it is killed by lmkd watchdog
...
After lmkd watchdog kills a process, its record should be removed.
Bug: 243567425
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: I70bb2a432df8088ebc9865fbc36b065738248d19
2022-08-25 20:14:23 +00:00
Suren Baghdasaryan
b1efc95cf3
lmkd: Remove process record after it is killed by lmkd watchdog am: c555ec6eeb am: 733be36274 am: f3d4403c12 am: 4ccdc36380
...
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/2193801
Change-Id: I88f395e6e82df5c849cdf7e378f0e7afcae1b2ff
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-08-24 18:16:13 +00:00
Suren Baghdasaryan
4ccdc36380
lmkd: Remove process record after it is killed by lmkd watchdog am: c555ec6eeb am: 733be36274 am: f3d4403c12
...
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/2193801
Change-Id: I8ae3ffe1e1ea0876f7029aa683e6f31bdaa78240
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-08-24 17:01:51 +00:00
Suren Baghdasaryan
f3d4403c12
lmkd: Remove process record after it is killed by lmkd watchdog am: c555ec6eeb am: 733be36274
...
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/2193801
Change-Id: I83ffc1bc746010c0fd63e4010a1a43020e42443e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-08-24 16:34:25 +00:00
Suren Baghdasaryan
733be36274
lmkd: Remove process record after it is killed by lmkd watchdog am: c555ec6eeb
...
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/2193801
Change-Id: I450caf1f6b317d003bbaeefce35c11f36aa4ba74
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-08-24 16:06:33 +00:00
Suren Baghdasaryan
c555ec6eeb
lmkd: Remove process record after it is killed by lmkd watchdog
...
After lmkd watchdog kills a process, its record should be removed.
Bug: 243567425
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: I70bb2a432df8088ebc9865fbc36b065738248d19
2022-08-23 15:28:53 -07:00
Ioannis Ilkos
7009c9dcd8
Remove kill_one_process tracepoint from lmkd am: b9d0592bba am: f8727745f9 am: 7324be6c63 am: fa8b9285b1
...
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/2175442
Change-Id: I0590fa2a5da3ea726c05f2c63c46754620816760
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-08-08 19:40:08 +00:00
Ioannis Ilkos
fa8b9285b1
Remove kill_one_process tracepoint from lmkd am: b9d0592bba am: f8727745f9 am: 7324be6c63
...
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/2175442
Change-Id: I4c4f4bb8136c0e755e3315719ef7190ba9130315
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-08-08 19:11:02 +00:00
Ioannis Ilkos
7324be6c63
Remove kill_one_process tracepoint from lmkd am: b9d0592bba am: f8727745f9
...
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/2175442
Change-Id: I267d82e4358bce89aa601fb9f39eb712dce3d9b6
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-08-08 18:46:27 +00:00
Ioannis Ilkos
f8727745f9
Remove kill_one_process tracepoint from lmkd am: b9d0592bba
...
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/2175442
Change-Id: I1fe55a6a05eae1be2e7acb76d71e8c2f280560ce
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-08-08 18:29:13 +00:00
Ioannis Ilkos
b9d0592bba
Remove kill_one_process tracepoint from lmkd
...
We already emit a richer slice (including pid and oom score) so there's
no reason for the additional print event
Bug: 195085238
Change-Id: I1140f0287934e5f0abdeeb64554a249c4c940def
2022-08-04 14:45:24 +01:00
Ken Chen
d1200b6f6e
Merge "Rename gpu_mem.o to gpuMem.o" am: 310fa3ab1b am: dd131835e9 am: 158b031098 am: 43fb4e1326
...
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/2147763
Change-Id: I71d9afbd7932d8f615d652374f3d91d59754997c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-21 23:34:32 +00:00
Ken Chen
43fb4e1326
Merge "Rename gpu_mem.o to gpuMem.o" am: 310fa3ab1b am: dd131835e9 am: 158b031098
...
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/2147763
Change-Id: I8209b1ab11dd02346459f898fb682395a2f5ce61
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-21 23:18:59 +00:00
Ken Chen
158b031098
Merge "Rename gpu_mem.o to gpuMem.o" am: 310fa3ab1b am: dd131835e9
...
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/2147763
Change-Id: I278afc525556e14993be4a5002e515adc837ede9
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-21 22:56:23 +00:00
Ken Chen
dd131835e9
Merge "Rename gpu_mem.o to gpuMem.o" am: 310fa3ab1b
...
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/2147763
Change-Id: If29b92d5706323d83b8f4c1098e680f1c0f93a67
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-21 22:21:40 +00:00
Ken Chen
310fa3ab1b
Merge "Rename gpu_mem.o to gpuMem.o"
2022-07-21 13:43:50 +00:00
Suren Baghdasaryan
433ed64df9
lmkd: Fix the text of the warning when pthread_setschedparam fails am: a0b25851c7 am: dbee4be68e
...
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/memory/lmkd/+/19353948
Change-Id: I6a4ee2dd4c1ffe7642a8c8436eb361a188ff65e1
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-20 22:04:03 +00:00
Suren Baghdasaryan
a1c8b19ad0
[conflict] [conflict] lmkd: set normal scheduling policy for reaper threads am: ab4c6d86e0 am: 20f830a109
...
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/memory/lmkd/+/19368099
Change-Id: I0c30e5054f3a9dbdc48911ba7f525810eaa397e3
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-20 20:49:55 +00:00
Suren Baghdasaryan
dbee4be68e
lmkd: Fix the text of the warning when pthread_setschedparam fails am: a0b25851c7
...
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/memory/lmkd/+/19353948
Change-Id: I7da59c567eb4827b8ea4c214037672c2a9a65bc9
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-20 20:18:24 +00:00
Suren Baghdasaryan
3930948948
lmkd: Fix the text of the warning when pthread_setschedparam fails am: a0b25851c7 am: 41a4a92781
...
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/memory/lmkd/+/19353948
Change-Id: I8aa4a78176663cfc45dd5ecb4d39197556d1cdea
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-20 20:17:10 +00:00
Suren Baghdasaryan
14588b3000
[conflict] lmkd: set normal scheduling policy for reaper threads am: ab4c6d86e0 am: a263af2be3
...
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/memory/lmkd/+/19353947
Change-Id: Ia79e2cf64c18688e04fe892f45be492e31af0753
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-20 18:35:32 +00:00
Suren Baghdasaryan
20f830a109
[conflict] lmkd: set normal scheduling policy for reaper threads am: ab4c6d86e0
...
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/memory/lmkd/+/19353947
Change-Id: Ic2f65feecbdfda400145ccd90d3f50ed71435380
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-20 18:12:26 +00:00
Suren Baghdasaryan
41a4a92781
lmkd: Fix the text of the warning when pthread_setschedparam fails am: a0b25851c7
...
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/memory/lmkd/+/19353948
Change-Id: I72ee11e88db52242e3f2f039bb73077e92accde9
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-20 18:00:53 +00:00
Suren Baghdasaryan
a263af2be3
lmkd: set normal scheduling policy for reaper threads am: ab4c6d86e0
...
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/memory/lmkd/+/19353947
Change-Id: I772a05dbbe6ccd662ff08e8aa95c017b22315c21
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-20 18:00:52 +00:00
Suren Baghdasaryan
a0b25851c7
lmkd: Fix the text of the warning when pthread_setschedparam fails
...
Fix the text of the warning when pthread_setschedparam fails to set
SCHED_OTHER scheduling policy for a reaper thread.
Bug: 237180716
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: I1b04713d145f4f3c243f16f932c753f5b06d48e6
2022-07-20 11:16:43 +08:00
Suren Baghdasaryan
ab4c6d86e0
lmkd: set normal scheduling policy for reaper threads
...
Reaper threads can take considerable time to free target's
memory running at RT priority that they inherit from LMKD.
This might prevent other critical tasks from being scheduled
while reaper threads are active.
Explicitly set reaper threads to run under normal scheduling
policy but set their nice value to ANDROID_PRIORITY_HIGHEST.
Bug: 237180716
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: Idad817e698ae1d5ac6cee5aa3281c69c7e0d257f
2022-07-20 11:16:06 +08:00
Treehugger Robot
f6c8f3edac
Merge "lmkd: Add clang-format upload hook" am: 8b4ad27706 am: db9a391406 am: 1fd840566e am: d68aa4a89c
...
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/2154453
Change-Id: I84b932631027da1c0737bb6f0f13de03355ae9c8
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-14 21:37:36 +00:00
Treehugger Robot
d68aa4a89c
Merge "lmkd: Add clang-format upload hook" am: 8b4ad27706 am: db9a391406 am: 1fd840566e
...
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/2154453
Change-Id: Ib329f15a2fa5fd797c68f9fd0ac37d3a0684b572
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-14 21:20:44 +00:00
Treehugger Robot
1fd840566e
Merge "lmkd: Add clang-format upload hook" am: 8b4ad27706 am: db9a391406
...
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/2154453
Change-Id: Ic25b988fc2e82d36f853c379870986e3178323f9
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-14 21:02:34 +00:00
Treehugger Robot
db9a391406
Merge "lmkd: Add clang-format upload hook" am: 8b4ad27706
...
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/2154453
Change-Id: I9c568f2690cfca9f3e469a54f62718920b39c2db
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-14 20:45:46 +00:00
Treehugger Robot
8b4ad27706
Merge "lmkd: Add clang-format upload hook"
2022-07-14 20:26:12 +00:00
Kalesh Singh
08bb956823
lmkd: Add clang-format upload hook
...
Check code formatting on upload.
Bug: N/A
Test: repo upload
Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
Change-Id: I7c849655539ac60e48cf2b4c25b33a1d222a6cfe
2022-07-14 11:18:20 -07:00
Ken Chen
4c18e91f22
Rename gpu_mem.o to gpuMem.o
...
Underscore character may cause bpf prog/map naming collision. For
example, x.o with map y_z and x_y.o with map z both result in x_y_z
prog/map name, which should be prevented during compile-time.
aosp/2147825 will prohibit underscore character in bpf source name
(source name derives the obj name). Existing bpf modules with underscore
characters in source name need to be updated accordingly.
Bug: 236706995
Test: adb root; adb shell ls -l /sys/fs/bpf/ | grep gpuMem
Change-Id: I213624e59ce1bca6ee7c22028504f2d51e9c50df
2022-07-08 19:09:50 +08:00
Yuming Han
1a19315add
lmkd : Fixed running wrong for Go devices when use_minfree_levels is TRUE am: ed8fc168e6 am: f3f9ff6e01 am: 60325c06b4 am: b80303c377
...
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/2144719
Change-Id: I62c758560792bcbb6bcd627e4eb7f1f4a2449a81
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-07 19:51:50 +00:00
Yuming Han
b80303c377
lmkd : Fixed running wrong for Go devices when use_minfree_levels is TRUE am: ed8fc168e6 am: f3f9ff6e01 am: 60325c06b4
...
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/2144719
Change-Id: I232c2f0afd705838e99896740f77c6e8a32c8f13
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-07 19:36:13 +00:00
Suren Baghdasaryan
0932e5c765
lmkd: Fix the text of the warning when pthread_setschedparam fails am: 508e73e105 am: 4a4e1590f1 am: 8d1acb0268 am: 45c03b00f7
...
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/2147680
Change-Id: I510eb3be2cb23e3e6381198ce31819409889151f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-07 19:17:11 +00:00