Commit Graph

40058 Commits

Author SHA1 Message Date
Suren Baghdasaryan 63dadcf79e lmkd: Implement kill timeout
(cherry pick from commit caa2dc56fd)

New ro.lmk.kill_timeout_ms property defines timeout in ms after a
successful kill cycle for more kills to be considered. This is
necessary because memory pressure after a kill does not go down
instantly and system needs time to reflect new memory state. This
timeout prevents extra kills in the period immediately after a
kill cycle. By default it is set to 0 which disables this feature.

Bug: 63631020
Test: alloc-stress

Change-Id: Ia847118c8c4a659a7fc38cd5cd0042acb514ae28
Merged-In: Ia847118c8c4a659a7fc38cd5cd0042acb514ae28
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2018-03-02 01:15:01 +00:00
Suren Baghdasaryan aa73bafea7 lmkd: Allow killing multiple processes to downgrade memory pressure
(cherry pick from commit 65f54a2665)

Record free memory at low vmpressure levels and whenever pressure
increases beyond low free up enough memory to downgrade memory pressure
to low. This is done by freeing enough memory to get to the max free
memory levels seen during low vmpressure.
The kill logic for Go devices is not changed as these devices are designed
to operate under high memory pressure.

Bug: 63631020
Test: alloc-stress

Change-Id: Ic8396eee08013b1c709072a13525601d5c8bf1f1
Merged-In: Ic8396eee08013b1c709072a13525601d5c8bf1f1
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2018-03-02 01:14:13 +00:00
Suren Baghdasaryan 1a2589e52b lmkd: Detect the highest level of vmpressure when event is detected
(cherry pick from commit e82e15c242)

lmkd checks for vmpressure events using epoll_wait() with eventfds of
all registered events. It's possible that multiple events of different
priorities happen before epoll_wait() returns. For these cases we
use conservative approach by assuming that the system is under the
highest registered vmpressure levels. This speeds up lmkd response time
to high memory pressure by not responding to possibly stale low pressure
levels when vmpressure rises quickly.

Bug: 63631020
Test: alloc-stress

Change-Id: I79a85c3342e7e1b3a3be82945266b2cc60b437cf
Merged-In: I79a85c3342e7e1b3a3be82945266b2cc60b437cf
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2018-03-02 01:13:16 +00:00
Tom Cherry c3892c045f Merge "Restrict setting platform properties from vendor .prop files" 2018-03-02 01:12:32 +00:00
Suren Baghdasaryan ab05d67d86 lmkd: Close cgroup.event_control file when done writing
(cherry pick from commit 1bd2fc4fb6)

After events are specified by writing into cgroup.event_control file
the file should be closed.

Change-Id: Id015e6a7bac2b74bbc8d8793c85f529ee00bdf55
Merged-In: Id015e6a7bac2b74bbc8d8793c85f529ee00bdf55
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2018-03-02 01:12:29 +00:00
Suren Baghdasaryan e57c3d313d lmkd: Remove stale dependency on libprocessgroup
(cherry pick from commit b333f83481)

Remove stale dependencies and header file inclusions

Change-Id: Ic0e7adb5bd2a0832937a831b6918e52ace4ad46a
Merged-In: Ic0e7adb5bd2a0832937a831b6918e52ace4ad46a
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2018-03-02 01:11:34 +00:00
Suren Baghdasaryan e1217c025d lmkd: Add ability to trace lmkd kills
(cherry pick from commit c71355991d)

For tracing lmkd kills inside kernel it is useful to have traces
indicating when and which process lmkd is killing. By default the
tracing is disabled.

Bug: 63631020
Test: alloc-stress

Change-Id: I3ceb2bde0c292eec55855cb4535927f3b4c5d08b
Merged-In: I3ceb2bde0c292eec55855cb4535927f3b4c5d08b
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2018-03-02 01:10:42 +00:00
Suren Baghdasaryan b93764db9c lmkd: add logic to kill the heaviest of the eligible processes
(cherry pick from commit 662492ab1d)

Killing the most memory-demanding process from the set of eligible
processes yields better results on high-performance devices than
killing the first one we could find. This is in line with how in-kernel
lowmemorykiller driver chooses its victims.

Bug: 63631020
Test: alloc-stress

Change-Id: Ie1ef7f33f3e79698a9b4120c14490386d6129f9b
Merged-In: Ie1ef7f33f3e79698a9b4120c14490386d6129f9b
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2018-03-02 01:09:12 +00:00
Suren Baghdasaryan e5c9643119 lmkd: change defaults to disable event upgrade/downgrade logic
(cherry pick from commit ad2fd9150b)

vmpressure upgrade/downgrade logic based on swap utilization works well
for low memory devices because of a small swap size, however for high
performance devices this measure is not a good indication of the memory
pressure because of large swap resources. This change sets the default
levels to disable upgrade/downgrade logic by default and each device
can set these properties appropriately.

Bug: 63631020
Test: alloc-stress

Change-Id: Ifd4fbd4d6bb3e82f0f87b029df94934f1e7b1c9c
Merged-In: Ifd4fbd4d6bb3e82f0f87b029df94934f1e7b1c9c
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2018-03-02 01:07:42 +00:00
Yi Kong 42d12f82bc Merge "Remove unreachable condition" am: a281389bf4 am: 061759246c
am: 7a4070ca95

Change-Id: I9431f46a90cd1b08569a2413ab5ecc0699a0f880
2018-03-02 01:06:14 +00:00
Yi Kong 7a4070ca95 Merge "Remove unreachable condition" am: a281389bf4
am: 061759246c

Change-Id: Icbdf441bc974fe97c73343ff1d92e3f0d6fabaaa
2018-03-02 01:00:34 +00:00
Yi Kong 061759246c Merge "Remove unreachable condition"
am: a281389bf4

Change-Id: I99e38d37f5fae3a71787eb6c63826c5fc57ba653
2018-03-02 00:55:28 +00:00
Treehugger Robot a281389bf4 Merge "Remove unreachable condition" 2018-03-02 00:48:42 +00:00
Paul Crowley e242a97db5 Revert "If enablefilecrypto or init_user0 fails, reboot into recovery."
This reverts commit 959b055535.

Reason for revert: b/73968735
Bug: 73968735
Test: b/73968735#comment5

Change-Id: Ifce4c029bab7380c60e20cc2b2885beb4a097456
2018-03-01 23:24:20 +00:00
Tom Cherry dde4c14c9f Merge "Clean up property set error handling" am: fe6cc42de4 am: d9b54aeb48
am: 0a6357dfea

Change-Id: I7008fe4726a4cec772be67d678cccff93398b47f
2018-03-01 23:15:02 +00:00
Tom Cherry 0a6357dfea Merge "Clean up property set error handling" am: fe6cc42de4
am: d9b54aeb48

Change-Id: Id7bfa9025f513719a1abbac5d240cdf4759b5886
2018-03-01 23:09:53 +00:00
Tom Cherry d9b54aeb48 Merge "Clean up property set error handling"
am: fe6cc42de4

Change-Id: I5f3c0dcdf8cc56374d9fc4e23283373a376c3913
2018-03-01 23:04:49 +00:00
Tom Cherry fe6cc42de4 Merge "Clean up property set error handling" 2018-03-01 22:54:24 +00:00
Yi Kong 141cceee58 Remove unreachable condition
Comparison of unsigned enum expression < 0 is always false. Fixes
tautological-unsigned-enum-zero-compare warning.

Bug: 72331526
Test: m
Change-Id: I17eb218b256015f5f406fd24324a49b05a0e8866
2018-03-01 22:54:08 +00:00
George Burgess IV a712e2164a Merge "Add a NOLINT for the memory leak we added" am: 10f62351eb am: 4e3ae2cbfa
am: ad4025b35b

Change-Id: I1d4831bc70b8874e66583f4a130b3a711c24b019
2018-03-01 22:19:41 +00:00
George Burgess IV ad4025b35b Merge "Add a NOLINT for the memory leak we added" am: 10f62351eb
am: 4e3ae2cbfa

Change-Id: I32d7a736428f38c68ccf90947841732eaae4c224
2018-03-01 22:15:07 +00:00
George Burgess IV 4e3ae2cbfa Merge "Add a NOLINT for the memory leak we added"
am: 10f62351eb

Change-Id: I67067e5611b14a6a7a818adb503a07f8a9e2dcef
2018-03-01 22:10:28 +00:00
Treehugger Robot 10f62351eb Merge "Add a NOLINT for the memory leak we added" 2018-03-01 22:00:02 +00:00
Suren Baghdasaryan cd7ad2f081 lmkd: add ability to monitor all vmpressure events
(cherry pick from commit 96bf3a600c)

Ability to monitor all available vmpressure event levels is needed
to accommodate systems with different memory resources. Low memory
systems can rely on medium and critical level events because working
under memory pressure is usual mode of operation. High performance
systems with more memory need to react earlier using also low
vmpressure level events to free memory early and prevent low memory
condition affecting its performance.

Bug: 63631020
Test: alloc-stress

Change-Id: I0cef1bd4c97d32c005045ae47f0ce3464ed98899
Merged-In: I0cef1bd4c97d32c005045ae47f0ce3464ed98899
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2018-03-01 21:40:13 +00:00
Adam Lesinski b354dcef98 Remove empty zip warning on host builds
Change-Id: Iaafe208930c316cc32f39ce2687be555b9eeb35f
2018-03-01 21:33:49 +00:00
Tom Cherry dc375869ab Restrict setting platform properties from vendor .prop files
We should only allow vendor-init-settable properties to be set from
.prop files on /vendor and /odm.

Bug: 73905119
Test: test on walleye that disallowed properties are rejected
Change-Id: I2a5d244fdc71060ddda3e3d87442e831e6b97831
2018-03-01 11:17:07 -08:00
Tom Cherry 69d47aa829 Clean up property set error handling
Currently we only report why a property set call has failed but drop
the context of what was trying to set the property.  This change
adds information about why a property was trying to be set when it
fails.

It also unifies property_set() within init to go through the same
HandlePropertySet() function as normal processes do, removing unneeded
special cases.

Test: boot bullhead
Test: attempt to set invalid properties and see better error messages
Change-Id: I5cd3a40086fd3b226e9c8a5e3a84cb3b31399c0d
2018-03-01 11:14:02 -08:00
Steven Moreland 977f72f9bc String16: remove integer overflows
Bug: 73826242
Test: manual
Change-Id: I32e13d61b944c1a527cf2d95473552d246e322be
2018-03-01 11:04:08 -08:00
George Burgess IV 657db00e3d Add a NOLINT for the memory leak we added
Added by I7255d45335fa009dc9e5de99dff67af52bd70e06

Bug: None
Test: Ran the analyzer. Complaint is gone.
Change-Id: Id9b8debd8b9690210f5a8e19154ee3a5095b8fbd
2018-03-01 18:59:50 +00:00
Tom Cherry 29717e60b4 Merge "Don't build host_init_verifier on Android either" am: 45ee43b1ac am: 274e082328
am: 9b973fe995

Change-Id: Ie20d27796eec124c4cf374ee67095c48afe35d45
2018-03-01 06:07:17 +00:00
Tom Cherry 9b973fe995 Merge "Don't build host_init_verifier on Android either" am: 45ee43b1ac
am: 274e082328

Change-Id: I8dd577d3e889dc3412e991497cdbece4300b5860
2018-03-01 06:02:01 +00:00
Tom Cherry 274e082328 Merge "Don't build host_init_verifier on Android either"
am: 45ee43b1ac

Change-Id: I9e065aeecff7aac555cae8817fea231c86cd3a1b
2018-03-01 05:52:36 +00:00
Tom Cherry 45ee43b1ac Merge "Don't build host_init_verifier on Android either" 2018-03-01 05:46:39 +00:00
Tom Cherry 547f7318c2 Don't build host_init_verifier on Android either
Also fixes another mac build issue...

Test: linux builds still work...
Change-Id: I549891c7e38729bd5fbe79f79b7345dabd9b4b28
2018-02-28 21:43:59 -08:00
Tom Cherry dd48eb7efe Merge "Don't build host_init_verifier for darwin" am: 28d364792f am: 237f1bfb68
am: 30f64de771

Change-Id: I99fa596cd7988cd6885c333428f766f98ef8f913
2018-03-01 01:47:47 +00:00
Tom Cherry 30f64de771 Merge "Don't build host_init_verifier for darwin" am: 28d364792f
am: 237f1bfb68

Change-Id: I69af47b6bcfd48a23933adfd290c9a921eb88202
2018-03-01 01:43:43 +00:00
Tom Cherry 237f1bfb68 Merge "Don't build host_init_verifier for darwin"
am: 28d364792f

Change-Id: Iefe249657adcf9b1d1a871650b65525dac678510
2018-03-01 01:38:07 +00:00
Tom Cherry 28d364792f Merge "Don't build host_init_verifier for darwin" 2018-03-01 01:25:32 +00:00
Tom Cherry 96ff0fed82 Don't build host_init_verifier for darwin
And therefore fix the mac build break.

Test: none
Change-Id: Ice28780abc62fc3e46119497d23bcbc124354159
2018-02-28 17:21:14 -08:00
Tom Cherry 451f83d476 Merge "init: add host side parser for init" am: 49fd480ede am: 7b649a5b50
am: 3597339226

Change-Id: Iaa6dd9c658a21017b2e4b61f6aab4e2572137ce2
2018-03-01 00:25:54 +00:00
Tom Cherry 3597339226 Merge "init: add host side parser for init" am: 49fd480ede
am: 7b649a5b50

Change-Id: If4bf32e9cda90fb1e389ed3ce26313d7aa9775d4
2018-03-01 00:20:51 +00:00
Tom Cherry 7b649a5b50 Merge "init: add host side parser for init"
am: 49fd480ede

Change-Id: Idf901f1b3094f5ff3f3a3886f1dc72157282ee17
2018-03-01 00:16:28 +00:00
Tom Cherry 49fd480ede Merge "init: add host side parser for init" 2018-03-01 00:04:49 +00:00
Josh Gao 0e459e1d47 Merge "adb: add a way to make the server intentionally leak." am: 1ac7150590 am: 9ba182e3bb
am: 399c3591f2

Change-Id: Ifa340ad4f3ce53786391722a7d4f8b97816dfd20
2018-02-28 23:16:34 +00:00
Josh Gao 399c3591f2 Merge "adb: add a way to make the server intentionally leak." am: 1ac7150590
am: 9ba182e3bb

Change-Id: I2f27b341ebceccefbc055c8b98dd14526767baff
2018-02-28 23:12:25 +00:00
Josh Gao 9ba182e3bb Merge "adb: add a way to make the server intentionally leak."
am: 1ac7150590

Change-Id: I4765b5726985555c5c7b325da2b779c7f1687dc0
2018-02-28 23:07:50 +00:00
Treehugger Robot 1ac7150590 Merge "adb: add a way to make the server intentionally leak." 2018-02-28 22:56:30 +00:00
Josh Gao e2176118f4 adb: add a way to make the server intentionally leak.
Add a way to test LeakSanitizer with the server by adding an
environment variable that intentionally leaks.

Test: ASAN_OPTIONS=detect_leaks=1:leak_check_at_exit=1 ADB_LEAK=1 adb server nodaemon
Change-Id: I7255d45335fa009dc9e5de99dff67af52bd70e06
2018-02-28 14:16:14 -08:00
Mark Salyzyn 61421baf96 lmkd: move sundry pieces to statslog.h
Pragma once is not part of the standard, and is actually a gnu
C++ addition. Android coding standard requires the #ifndef header
wrappers. Moved things that belong in statslog.h from the lmkd files.

SideEffects: None
Test: lmkd_unit_tests
Bug: 33808187
Bug: 72838192
Change-Id: I9686b1a0791ee2b723d05b91905eda0bb64a1156
2018-02-28 19:36:12 +00:00
Colin Cross a112e1c402 Merge "Make memunreachable_binder_test suitable for VTS" am: c8a22bc1af am: ab9ca8beb5
am: ca18f082aa

Change-Id: Ie5d3533221128a0693b17e5345bbfd0f4fde96af
2018-02-28 19:32:35 +00:00