Commit Graph

272 Commits

Author SHA1 Message Date
Bill Rassieur 6bb974bc2a Merge PQ1A.181205.006 from Pi-QPR1-Release into ToT for Pi-Platform release.\n\nBUG: 120448245
Change-Id: Ia66dd2a90e074d2fcb0dbaeb424031a41752dd03
2018-12-04 17:00:05 +00:00
Suren Baghdasaryan a8944aa6c5 Merge "lmkd: Cleanup unused code for killing processes in bulk" am: d04b38b0e5
am: 46d6d26c6c

Change-Id: I7ce93b79b64d43eae08a4b316e4cbb655e3d4e06
2018-10-29 13:44:53 -07:00
Suren Baghdasaryan 7d850ecac4 Merge "lmkd: retune rate at which processes are killed" am: d5eaeffcf3
am: 4d8a9caf30

Change-Id: Iba588d2de887372874bacb1f0a6dc829c0c021c7
2018-10-29 13:44:01 -07:00
Suren Baghdasaryan 68fe0cbc93 Merge "lmkd: Cleanup unused code for killing processes in bulk"
am: d04b38b0e5

Change-Id: Icbbc888b5a2049a94e55e48eaa9510981c114ebf
2018-10-29 13:31:26 -07:00
Suren Baghdasaryan f12fdbe1d6 Merge "lmkd: retune rate at which processes are killed"
am: d5eaeffcf3

Change-Id: I5012c959668b9bf2f6ea055e6186be551bf5db20
2018-10-29 13:30:42 -07:00
Tim Murray e0b5a53c5b [automerger skipped] DO NOT MERGE: lmkd: retune rate at which processes are killed
am: afb3a15f39  -s ours

Change-Id: I6f11779b2b686ac61f4444e2dfba311ac6b4a6c9
2018-10-29 10:14:09 -07:00
Suren Baghdasaryan 85c31b57c4 lmkd: Cleanup unused code for killing processes in bulk
find_and_kill_processes() does not kill multiple processes at a time
anymore. Remove support for bulk process killing.

Change-Id: Id09132a9cebe44589a1a3ebcbff800a16fa56557
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2018-10-29 16:20:50 +00:00
Tim Murray a79ec0f5bf lmkd: retune rate at which processes are killed
Kill a single process at a time and try to wait up to 100ms for
that process to reclaim memory before triggering another kill.

Test: boots, works
bug: 116877958
Change-Id: I6775d0534b3e3728c04389d3eae1a00e3cbf9f27
2018-10-29 16:20:29 +00:00
Tim Murray 9752ee8b29 DO NOT MERGE: lmkd: retune rate at which processes are killed
Kill a single process at a time and try to wait up to 100ms for
that process to reclaim memory before triggering another kill.

Test: boots, works
bug: 116877958
Change-Id: I6775d0534b3e3728c04389d3eae1a00e3cbf9f27
(cherry picked from commit afb3a15f39e73978c071a58d3466993293c6d3b1)
2018-10-26 20:57:25 +00:00
Suren Baghdasaryan d4dbf08947 lmkd: rate-limit and cleanup failed kill reports
Excessive number of failed kill reports when lmkd can't find an eligible
process to kill or frees not enough memory pollutes logs and bugreports.
Cleanup kill reports to remove duplicate information and rate limit failed
kill attempts at 1 report per sec. The number of suppressed failed kills
will be reported in the next lmkd report.

Bug: 113864581
Test: Verified using lmkd_unit_test
Change-Id: I67fa1fec97613f136c7582115edcbc56b1503c9c
Merged-In: I67fa1fec97613f136c7582115edcbc56b1503c9c
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
(cherry picked from commit d6cbf3f41d7cb54e7dc62f4c29f7a7cba05aa28b)
2018-10-26 20:57:23 +00:00
Tim Murray 6a9c142f1b DO NOT MERGE: lmkd: retune rate at which processes are killed
Kill a single process at a time and try to wait up to 100ms for
that process to reclaim memory before triggering another kill.

Test: boots, works
bug: 116877958
Change-Id: I6775d0534b3e3728c04389d3eae1a00e3cbf9f27
2018-10-26 13:21:17 -07:00
Bill Yi 75fc74cc6a [automerger skipped] Merge pie-platform-release to aosp-master - DO NOT MERGE am: d4e20cd0f9 -s ours
am: 6f691264b0  -s ours

Change-Id: I0e2fd6cf802c4b132d0b5d4daa1c7bde3b1f323d
2018-10-24 19:54:21 -07:00
Suren Baghdasaryan 0a31d7860a Merge "lmkd: Add command to get number of kills" am: a1c684be4f
am: e518e0a1b8

Change-Id: Ibe242de81e5e7cf027763a67dafde70621a7e152
2018-10-24 19:52:18 -07:00
Bill Yi a6426eb63b [automerger skipped] Merge pie-platform-release to aosp-master - DO NOT MERGE
am: d4e20cd0f9  -s ours

Change-Id: Ie17a382505e1b8f6fb135a415f6fa8c9671354e4
2018-10-24 16:38:21 -07:00
Bill Yi 5b3b22bbc2 Merge pie-platform-release to aosp-master - DO NOT MERGE
Change-Id: I413bb086f5ff064430c061bdd5d0fe3d02925304
2018-10-24 14:48:45 -07:00
Suren Baghdasaryan 301581b8af Merge "lmkd: Add command to get number of kills"
am: a1c684be4f

Change-Id: I0e22129a27765cacb7840a3c60b95b20c9d0d42d
2018-10-24 14:45:11 -07:00
Suren Baghdasaryan a7394ea37f lmkd: Add command to get number of kills
Intrduce LMK_GETKILLCNT command for ActivityManager to get the number of
kills from lmkd.

Bug: 117126077
Test: used lmkd_unit_test to verify correct reporting
Change-Id: I09c720a7176b4df95efc544177cd2694f8d791be
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2018-10-24 17:18:32 +00:00
Bill Yi d3579c32ef [automerger skipped] Merge pi-platform-release to stage-aosp-master - DO NOT MERGE
am: 9b472034fe  -s ours

Change-Id: I425c3c5cc8d042ac822351d7a395922048eae0f8
2018-10-24 09:46:29 -07:00
Bill Yi 850ee989e4 Merge pi-platform-release to stage-aosp-master - DO NOT MERGE
Change-Id: Ibdbef72fcbee2eb6688f526e353f7244b93df734
2018-10-24 09:18:47 -07:00
Srinivas Paladugu 66286cb747 Merge "lmkd: increase the soft limit for keyboard" am: 618be4c225
am: a213c8931c

Change-Id: Ie7abdb7dcd106b31ff3b59998cf4d3636ae25411
2018-10-16 13:38:12 -07:00
Srinivas Paladugu bab828217f Merge "lmkd: increase the soft limit for keyboard"
am: 618be4c225

Change-Id: Ia475bcd0feaaeaf0ea9cb2a8af9bc12e020532fd
2018-10-16 13:31:00 -07:00
Srinivas Paladugu a453f0b9ee lmkd: increase the soft limit for keyboard
lmkd sets the soft limit parameters for Go devices.
The limit for apps in the perceptible group is set to 16M.
However this limit is not sufficient for the keyboard app to
prevent pages from being re-claimed quickly. The mem usage of
the keyboard app is around 55M most cases with some occasional
spikes to 70-80M. Increasing the limit to 64M improves the warm
startup latency for keyboard. It is still lower than the limits
set for foreground and visible apps.

Test: Go device (1G)
Bug: 117517805
Merged-In: Id50e49327cfd76126e41ef6503971845f29196af
Change-Id: Id50e49327cfd76126e41ef6503971845f29196af
2018-10-16 18:58:01 +00:00
Suren Baghdasaryan 22ec342a67 Merge "lmkd: Implement pid purge command to clear old pids when zygote restarts" am: 79e5b550ce
am: c95bfa5e9e

Change-Id: I55d31cc28dafdd24132e3234bc92e53028c4063b
2018-10-15 13:17:43 -07:00
Suren Baghdasaryan fee8b42c10 Merge "lmkd: Implement pid purge command to clear old pids when zygote restarts"
am: 79e5b550ce

Change-Id: I054cc48a4f9106f0a4e9f313bf997facac9c1b1e
2018-10-15 13:07:28 -07:00
Rajeev Kumar 742a2ed4f0 [automerger skipped] Merge "Read memory stats from /proc/pid/stat file." into pi-dev
am: e77572d76d  -s ours

Change-Id: I1a594da0c5eda810d641e33809fae5c695606d68
2018-10-15 12:42:52 -07:00
TreeHugger Robot cc7862d9b7 Merge "Read memory stats from /proc/pid/stat file." into pi-dev 2018-10-15 19:24:44 +00:00
Suren Baghdasaryan 83df0088a3 lmkd: Implement pid purge command to clear old pids when zygote restarts
lmkd keeps a list of pids registered by ActivityManager, however on rare
occasions when framework restarts and lmkd survives that list has to be
purged. Implement a command that can be used to clear the pid list.

Bug: 116801366
Test: locally by killing zygote process
Change-Id: I71d6012f86bb83a73edd5b687e05a0848e0569b1
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2018-10-15 16:22:17 +00:00
Suren Baghdasaryan a6573c818c lmkd: Implement pid purge command to clear old pids when zygote restarts
am: c89be17730

Change-Id: I11ebb0c22eedeaebd1c8f55ad5bec17abb82ba82
2018-10-12 16:43:03 -07:00
Suren Baghdasaryan 3134deab6b Merge "lmkd: Fix an invalid access to a pointer after it's freed" am: 1f149d8d2a
am: 8950a02d10

Change-Id: I87ec58231106933ef3cdcec50110c307bd2b3b83
2018-10-12 14:44:40 -07:00
Suren Baghdasaryan fd42ffb457 Merge "lmkd: Fix an invalid access to a pointer after it's freed"
am: 1f149d8d2a

Change-Id: I3bd979baf13d574b0f3f6eef1236512d9342640e
2018-10-12 14:39:28 -07:00
Rajeev Kumar d128423ee4 Read memory stats from /proc/pid/stat file.
(cherry pick from commit 0301683e49ab255769b15469487feaab3466167a)
Bug: 117333340
Test: Manual testing using alloc-stress tool
Change-Id: Ie555933aafa6a6b7aa1dbf5518ebe804376e0afd
Merged-In: Ie555933aafa6a6b7aa1dbf5518ebe804376e0afd
2018-10-12 21:28:50 +00:00
Suren Baghdasaryan 8b00c6d79a lmkd: Fix an invalid access to a pointer after it's freed
pid_remove() frees a structure representing registered process and the
pointer can't be used anymore. This change fixes an instance when pointer
was used after it was freed. pid_remove() is moved to the end of the
function and comments are added to prevent similar situation in the future.

Bug: 117625315

Change-Id: I6a922952a31232497b3f9caf87d5a21bd402db94
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2018-10-12 11:28:33 -07:00
Rajeev Kumar 2cbeb781f6 [automerger skipped] Merge "Read memory stats from /proc/pid/stat file." into stage-aosp-master
am: ab0cfea162  -s ours

Change-Id: I08e70c57079b586c34317f262f8a02d3bc9876f7
2018-10-12 10:58:43 -07:00
Rajeev Kumar 2b07944e79 Read memory stats from /proc/pid/stat file.
(cherry pick from commit 0301683e49ab255769b15469487feaab3466167a)
Bug: 117333340
Test: Manual testing using alloc-stress tool
Merged-In: Ie555933aafa6a6b7aa1dbf5518ebe804376e0afd
Change-Id: Ie555933aafa6a6b7aa1dbf5518ebe804376e0afd
2018-10-10 18:20:10 -07:00
Rajeev Kumar f46ba8edf1 [automerger skipped] Merge "Read memory stats from /proc/pid/stat file." am: d936e628a3 -s ours
am: e10165769e

Change-Id: Ie08d729a9944e72f0392f4b626e29cff31166b53
2018-10-10 18:03:58 -07:00
Rajeev Kumar 6a4ee28b85 [automerger skipped] Merge "Read memory stats from /proc/pid/stat file."
am: d936e628a3  -s ours

Change-Id: Ifcc16f31ad7dc9b9a6f7071dbbb5741fc96c064d
2018-10-10 17:50:52 -07:00
Rajeev Kumar 2534d2e54d Read memory stats from /proc/pid/stat file.
(cherry pick from commit 0301683e49ab255769b15469487feaab3466167a)
Bug: 117333340
Test: Manual testing using alloc-stress tool
Merged-In: Ie555933aafa6a6b7aa1dbf5518ebe804376e0afd
Change-Id: Ie555933aafa6a6b7aa1dbf5518ebe804376e0afd
2018-10-10 22:23:25 +00:00
Suren Baghdasaryan 08df7871d3 lmkd: Implement pid purge command to clear old pids when zygote restarts
lmkd keeps a list of pids registered by ActivityManager, however on rare
occasions when framework restarts and lmkd survives that list has to be
purged. Implement a command that can be used to clear the pid list.

Bug: 116801366
Test: locally by killing zygote process
Change-Id: I71d6012f86bb83a73edd5b687e05a0848e0569b1
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2018-10-10 22:11:23 +00:00
Suren Baghdasaryan 0421ee6865 [automerger skipped] lmkd: rate-limit and cleanup failed kill reports
am: d6cbf3f41d  -s ours

Change-Id: Ic59dd4599ce3d9aaf3715aa40a58e9088e68c4ad
2018-09-12 15:41:44 -07:00
Suren Baghdasaryan 16e959bc67 lmkd: rate-limit and cleanup failed kill reports
Excessive number of failed kill reports when lmkd can't find an eligible
process to kill or frees not enough memory pollutes logs and bugreports.
Cleanup kill reports to remove duplicate information and rate limit failed
kill attempts at 1 report per sec. The number of suppressed failed kills
will be reported in the next lmkd report.

Bug: 113864581
Test: Verified using lmkd_unit_test
Change-Id: I67fa1fec97613f136c7582115edcbc56b1503c9c
Merged-In: I67fa1fec97613f136c7582115edcbc56b1503c9c
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2018-09-07 18:27:17 -07:00
Suren Baghdasaryan ba497f0324 Merge "lmkd: rate-limit and cleanup failed kill reports"
am: 83193c6c78

Change-Id: I087c782727e8c83afe606e0c23b42aa2e048e11b
2018-09-06 12:33:33 -07:00
Suren Baghdasaryan 53be36e6d8 lmkd: rate-limit and cleanup failed kill reports
Excessive number of failed kill reports when lmkd can't find an eligible
process to kill or frees not enough memory pollutes logs and bugreports.
Cleanup kill reports to remove duplicate information and rate limit failed
kill attempts at 1 report per sec. The number of suppressed failed kills
will be reported in the next lmkd report.

Bug: 113864581
Test: Verified using lmkd_unit_test
Change-Id: I67fa1fec97613f136c7582115edcbc56b1503c9c
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2018-09-06 01:59:49 +00:00
Suren Baghdasaryan 3e81b52bb8 Merge "lmkd: Introduce system property to get minfree and oom_adj levels"
am: ca2d03ebdb

Change-Id: I8cfbfb8ec49336820692d04af6efc8adae23820d
2018-09-05 17:08:24 -07:00
Suren Baghdasaryan 1ed0db1a19 lmkd: Introduce system property to get minfree and oom_adj levels
Introduce sys.lmk.minfree_levels system property to allow minfree level
reporting. The format for this property is:

<minfree 1>:<oom_adj 1>, <minfree 2>:<oom_adj 2>, ...

Max number of minfree levels is 6 and they are specified in the
increasing order. For example:

sys.lmk.minfree_levels=18432:0,23040:100,27648:200,32256:300,55296:900,80640:906

sys.lmk.minfree_levels updates are ratelimited to once per second in order
to prevent DoS attacks.

Bug: 111521182
Test: getprop sys.lmk.minfree_levels returns expected value
Change-Id: I80d75d6836650b12457d6a99ca88898535837a97
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2018-09-05 10:54:22 -07:00
Vic Yang 19a9c239ba Merge "lmkd: Do not downgrade/ignore events when swap is full"
am: c48943165d

Change-Id: Id9497112443f9a11cbf2368dd10019359c4fc3ee
2018-08-14 16:10:18 -07:00
Treehugger Robot ac26903b12 Merge "lmkd: Do not downgrade/ignore events when swap is full" 2018-08-14 21:31:56 +00:00
Suren Baghdasaryan dcc35528fc Merge "lmkd: Add meminfo logging after each kill for easy troubleshooting"
am: 7bb1ae2d88

Change-Id: Ie54654d0dd35b9549b017a7e2d10b80536e4a3af
2018-08-10 18:57:09 -07:00
Suren Baghdasaryan 08bfa985d1 lmkd: Add meminfo logging after each kill for easy troubleshooting
While troubleshooting memory pressure related issues it's hard to get a
good view of the memory state when lmkd kill happens. Logging relevant
information from /proc/meminfo file that was used to make a kill decision
is very helpful for further analysis. To do this efficiently we are using
Android Logger event library functions and log the data used for kill
decision after the kill signal was issued.

Test: Run lmkd_unit_test and logcat -b events -v descriptive
Change-Id: Id5de41b9d91a04dd5d3eb9b85d4e1babe9755628
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2018-08-10 14:21:31 -07:00
Suren Baghdasaryan 456cdfd896 [automerger skipped] Merge "lmkd: Skip memory.stat usage when per-app memcgs are not used"
am: 1e0e1b44bd  -s ours

Change-Id: Ic2a13be530643b3b30c69587ec7dfbe76725474b
2018-08-08 11:38:50 -07:00
Vic Yang 65680690d7 lmkd: Do not downgrade/ignore events when swap is full
When the swap space is full, a pressure event is unlikely to resolve by
itself.  In this case, do not downgrade or ignore the events.

Bug: 112056451
Test: Fill up swap on a 1GB device and check critical vmpressure events
      are not downgraded.
Change-Id: If154dc364711bf7c86f32e24ddcd10be359386de
2018-08-08 10:00:06 -07:00