Commit Graph

1639 Commits

Author SHA1 Message Date
Dan Willemsen fa4c1d7be3 Revert "Only log the lmkd state change when the killing really happened."
am: 0051684905

Change-Id: I3fc6842348d7ede95dd5fcdca06271d90c4facb4
2018-05-14 20:31:29 -07:00
Dan Willemsen 8ce604bd15 Revert "Only log the lmkd state change when the killing really happened."
This reverts commit 5e60f88cab8a22d88d76f7fd49f5a6e9cc0d931b.

Reason for revert: broke some builds

Bug: 78603347
Change-Id: I46bf6face35f5399d7d43146b360c0703eedfb1a
2018-05-15 03:26:05 +00:00
Yangster-mac 4052ab6cf5 Only log the lmkd state change when the killing really happened. am: 5e60f88cab
am: 6d709b77c6

Change-Id: I29f7ff85bf67c2784c8e1399423c5d9746da5d5a
2018-05-14 19:27:32 -07:00
Yangster-mac 6411512fb9 Only log the lmkd state change when the killing really happened.
am: 5e60f88cab

Change-Id: I95e347eeb0d69493a15ed11d32ca91d532eb043e
2018-05-14 19:22:33 -07:00
Yangster-mac 7154a883f2 Only log the lmkd state change when the killing really happened.
Test: statsd test
BUG: b/78603347
Change-Id: Ie08b0c3260f2f96b48e9e12c2c88208a3613042d
2018-05-14 22:25:29 +00:00
android-build-team Robot 7388e2ea02 Snap for 4778776 from da88b24c9787f8babf790c7fca93e129143b41fe to pi-release
Change-Id: I487f4e0e0b4505d3bd4f264b2f95174743107226
2018-05-13 07:26:59 +00:00
Suren Baghdasaryan dbf2878449 lmkd: Enable more logs during a kill am: da88b24c97
am: 740d940074

Change-Id: I7d62f4afd52ccc657c060cca3392ac116a2c8e67
2018-05-11 16:05:13 -07:00
Suren Baghdasaryan c51a9c1e7f lmkd: Enable more logs during a kill
am: da88b24c97

Change-Id: Ieb4ed09ac5224843ee8f7fb44494eb291054223d
2018-05-11 14:15:09 -07:00
Suren Baghdasaryan eff8233ce4 lmkd: Enable more logs during a kill
Logs that provide information about memory conditions during a process
kill event contain useful information and do not affect device
performance because these events are rare. Enabling them even when
ro.config.debug flag is not set will help in understanding low memory
conditions.

Bug: 79572814

Change-Id: Iae6e9bb612b9a7904ca491de3f1ddc727f24c7e0
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2018-05-11 21:03:14 +00:00
android-build-team Robot ece1fc9bde Snap for 4765094 from 35c76427a2918434c9d7b38d2e9a7710b67c94cf to pi-release
Change-Id: I13426caff58344bbf5013d18ceb46b721e9c3522
2018-05-06 07:23:14 +00:00
Yao Chen b67737a586 Fix the stats log in lmkd am: 389aee1117
am: 89c1ea6deb

Change-Id: I092f761249940703eb6388ba02a8d43f825ee519
2018-05-04 13:55:47 -07:00
Yao Chen daf5980e0a Fix the stats log in lmkd
am: 389aee1117

Change-Id: I533b09089280681a9c41a3597c62ec621a870839
2018-05-04 13:40:47 -07:00
Yao Chen 337606cc8b Fix the stats log in lmkd
1. let logs be written to statsd directly like all other stats logs.
   + stats log should not write to logd anymore(b/78239479)
2. fixed the log format
   + need to embed the elapsed real time in the log
3. fixed the log context reuse problem
   +reset the log context buffer and internal state before reuse

Bug: 78603347
Bug: 78239479

Test: tested with alloc_stress, and saw logs written to statsd

performance measurement (memory & cpu):
https://paste.googleplex.com/5508158646648832

Change-Id: I345f0eace8ba1687ff480fb88e9abba1d8533f76
2018-05-03 16:04:27 -07:00
android-build-team Robot f9639bf07f Snap for 4728508 from e58d713e47bc798a546c3d2a2c40e2339527133d to pi-release
Change-Id: I00aaa6f7baef271b8b0cd90ef78adca9a0656c39
2018-04-18 07:26:11 +00:00
Mark Salyzyn b53f40a494 Merge "lmkd: limit capability set to minimum" am: 01ce44b734 am: c2d4d08be2
am: 7977e3d24d

Change-Id: Ib640b564c87255aa07ff8ce20224fae364966438
2018-04-17 15:47:18 -07:00
Mark Salyzyn 7339c79cfd Merge "lmkd: limit capability set to minimum" am: 01ce44b734
am: c2d4d08be2

Change-Id: Ic97ab3c4312d260c2aa8c7a30e203564cd72f61a
2018-04-17 15:34:06 -07:00
Suren Baghdasaryan fa4e5dfeb1 [automerger skipped] Merge "lmkd: Introduce support for legacy kill algorithm that uses minfree levels" am: 22dc27b9fa am: 6575d86d3d -s ours
am: 109024fc1e  -s ours

Change-Id: I45ecb6d88bec0b42831fb31c3ee93f8894f70134
2018-04-17 12:19:50 -07:00
Suren Baghdasaryan 4a3210d759 [automerger skipped] Merge "lmkd: Switch to using /proc/meminfo to have access to file cache size" am: 5176b4b37a am: 4573186a35 -s ours
am: 078583a7d5  -s ours

Change-Id: Ieb2dce5f0f54522c25bffbd4657dbe56315044bf
2018-04-17 12:17:48 -07:00
Suren Baghdasaryan 81063f17a7 resolve merge conflicts of 885ff611d73db3ebf62dbbba5ec331836721bde1 to pi-dev-plus-aosp
am: 7bdfc321a8

Change-Id: I798862c015074a0ce1fd494e620618de3a949fc2
2018-04-17 12:14:36 -07:00
Suren Baghdasaryan 7d2303b828 [automerger skipped] Merge "lmkd: Introduce support for legacy kill algorithm that uses minfree levels" am: 22dc27b9fa
am: 6575d86d3d  -s ours

Change-Id: I5f8ff20fb1537c5499687a0fb034ca0cfd05ec52
2018-04-17 12:10:08 -07:00
Suren Baghdasaryan 7e4722f018 [automerger skipped] Merge "lmkd: Switch to using /proc/meminfo to have access to file cache size" am: 5176b4b37a
am: 4573186a35  -s ours

Change-Id: I2ba06b51c59f36ceb421c48cbec96f23da5a6bb1
2018-04-17 12:07:42 -07:00
Suren Baghdasaryan 1eab917fc9 resolve merge conflicts of 885ff611d73db3ebf62dbbba5ec331836721bde1 to pi-dev-plus-aosp
Test: I solemnly swear I tested this conflict resolution.
Bug: None
Change-Id: I0dfd3b1424c106437acbd68059d14ca5b0146a8d
2018-04-17 10:38:06 -07:00
android-build-team Robot bea361295e Snap for 4725392 from 7cb8aade2072d16180083e41ca34f72747089357 to pi-release
Change-Id: I41683ad62b26109d9aa5eee925934092f6347d34
2018-04-17 07:23:59 +00:00
Suren Baghdasaryan d41cd264d7 [automerger skipped] lmkd: Introduce support for legacy kill algorithm that uses minfree levels am: ffdc4ddb25
am: df6f9e30ed  -s ours

Change-Id: I2fd7fc46f784ddaa60ce2dd226148f7e841ff2c8
2018-04-16 20:50:55 -07:00
Suren Baghdasaryan 50d47378bb [automerger skipped] lmkd: Switch to using /proc/meminfo to have access to file cache size am: 9926e57ee8
am: 81999c34b4  -s ours

Change-Id: Ic9c1943cf95be81e258b19e6d05225b7e5d5e51c
2018-04-16 20:49:34 -07:00
Suren Baghdasaryan 0bdbff553b [automerger skipped] lmkd: Add zoneinfo and meminfo parsing routines am: 8b9deaf618
am: a15a9c423d  -s ours

Change-Id: I54eb030b4985b4a6047655c184dd8cdd13fb3f3e
2018-04-16 20:49:11 -07:00
Suren Baghdasaryan 49319cb426 lmkd: Introduce support for legacy kill algorithm that uses minfree levels
am: ffdc4ddb25

Change-Id: Ic18a67fe5cbdf541f1b6c439e2b7f0488d4d1dcf
2018-04-16 20:45:49 -07:00
Suren Baghdasaryan 8c24c51d6a lmkd: Switch to using /proc/meminfo to have access to file cache size
am: 9926e57ee8

Change-Id: Ie3f2773b2dc970ddea5b67632921eedfe87afd4d
2018-04-16 20:44:46 -07:00
Suren Baghdasaryan c5b621e08c lmkd: Add zoneinfo and meminfo parsing routines
am: 8b9deaf618

Change-Id: I1132199473d335197cbc9677431d3e2937e123c6
2018-04-16 20:44:28 -07:00
Suren Baghdasaryan eaa59c7032 [automerger skipped] Merge changes I8e27f8b9,I78d2dc79 into pi-dev am: 7cb8aade20 -s ours
am: 67c048918d  -s ours

Change-Id: Id1916e0a548530376f94c65c23b6e08bc487ac52
2018-04-16 19:02:38 -07:00
Suren Baghdasaryan 2c4611a5ab lmkd: Introduce support for legacy kill algorithm that uses minfree levels
Add ability to switch to the algorithm used by lowmemorykiller driver
for determining when to kill. It uses minfree levels to decide at which
levels of free memory and file cache to kill a process. oom_adj_score
is also determined by comparing current memory resources against minfree
levels.
ro.lmk.use_minfree_levels property is introduces for switching into this
mode. By default it is disabled.

Bug: 77299493
Bug: 75322373
Change-Id: I6b51972951026854a079fcda33d6786b7ed035e4
Merged-In: I6b51972951026854a079fcda33d6786b7ed035e4
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
(cherry picked from commit d273b6630d47d6bb32996bcc87e01a73240cb228)
2018-04-17 01:42:06 +00:00
Suren Baghdasaryan e0f3dd132d lmkd: Switch to using /proc/meminfo to have access to file cache size
Current mechanism of getting system memory state by using sysinfo()
is not enough because it does not provide information about file cache
size which is needed to correctly assess memory state. Switch to using
data from /proc/meminfo that includes information provided by sysinfo()
and file cache size in addition to that.

Bug: 77299493
Bug: 75322373
Change-Id: I16106fc4f9254f17f776803e60502b7b6474e1b7
Merged-In: I16106fc4f9254f17f776803e60502b7b6474e1b7
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
(cherry picked from commit 9ac54eb2f88a4a8fc84d1da307be93f99573ead4)
2018-04-17 01:41:59 +00:00
Suren Baghdasaryan d28a973235 lmkd: Add zoneinfo and meminfo parsing routines
/proc/zoneinfo and /proc/meminfo contain information necessary for lmkd
to assess system memory state. Add routines to parse these files.

Bug: 77299493
Bug: 75322373
Change-Id: Ie7d80bbb81fd0d2fc0629f6f678e6afc97fed1f6
Merged-In: Ie7d80bbb81fd0d2fc0629f6f678e6afc97fed1f6
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
(cherry picked from commit da0bc05b2293095c4e1153268ae7b53773f8f5ed)
2018-04-17 01:41:38 +00:00
Suren Baghdasaryan 17dd7883e8 [automerger skipped] Merge changes I8e27f8b9,I78d2dc79 into pi-dev
am: 7cb8aade20  -s ours

Change-Id: I7d5028052cdb8982967c973f8668a2394ab72311
2018-04-16 17:55:08 -07:00
Mark Salyzyn a00ccd8656 lmkd: limit capability set to minimum
Set F() capability set and 'drop' lmkd from AID_ROOT to AID_LMKD uid
and from AID_ROOT to AID_LMKD and AID_SYSTEM gid.

/dev/memcg/memory.pressure defaults to root.root mode 0000, set it up
as root.system mode 0040 to allow lmkd read access.

Instrument failure to set SCHED_FIFO.

Annotate access points that require elevated capabilities.

Test: check /proc/`pidof lmkd`/status for capability set
Test: lmkd_unit_test
Bug: 77650566
Change-Id: I986081a0434cf6e842b63a55726380205b30a3ea
2018-04-16 14:51:56 -07:00
Suren Baghdasaryan 5ac8491088 [automerger skipped] lmkd: Rename is_go_device variable to better reflect its function am: 39a22e751b -s ours
am: 9c546131cd  -s ours

Change-Id: If738c7573cce9f6dcf0c3f8d8ae2d0761bd436ac
2018-04-16 13:20:53 -07:00
Suren Baghdasaryan 7bd2b43a2c [automerger skipped] lmkd: Add lmkd README file am: 9dbd937b4c -s ours
am: 2a07f8f940  -s ours

Change-Id: I584d202ea2b20277c2eb8eb1f140d15f2dcafdfa
2018-04-16 13:19:46 -07:00
Suren Baghdasaryan bec5651fb3 [automerger skipped] lmkd: Rename is_go_device variable to better reflect its function
am: 39a22e751b  -s ours

Change-Id: Ieeb82c7e7227a898aea7c3b1a54370f37e70c940
2018-04-16 13:15:14 -07:00
Suren Baghdasaryan 35c1df5249 [automerger skipped] lmkd: Add lmkd README file
am: 9dbd937b4c  -s ours

Change-Id: I6d703f0ad100ae885e7095bcbbe3d4eeee7628c1
2018-04-16 13:14:00 -07:00
Suren Baghdasaryan c482e927a2 lmkd: Optimize frequent file reads by keeping file descriptors open
To check system memory state lmkd is using same files every time vmpressure
event is received. Instead of opening and closing these files every time
we store the file descriptor and use pread() to reread the file from
the beginning.

Bug: 77299493
Bug: 75322373
Change-Id: I8e27f8b9526e82e3cc313a02fce215c2e4dd3d29
Merged-In: I8e27f8b9526e82e3cc313a02fce215c2e4dd3d29
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
(cherry picked from commit d716fe3610aae8cefcc676ade00c7bfd2b823c20)
2018-04-16 09:33:44 -07:00
Suren Baghdasaryan 9b5a5869e9 lmkd: Fix usage of ro.lmk.kill_heaviest_task property
lmkd should use ro.lmk.kill_heaviest_task property to select between
algorithms for victim selection. Set ro.lmk.kill_heaviest_task default
value to false in order to keep it compatible with previous versions
of lmkd (killing the heaviest task is a new mechanism).

Bug: 77299493
Bug: 75322373
Change-Id: I78d2dc79d9c54e636c26665605518d9c87b535b3
Merged-In: I78d2dc79d9c54e636c26665605518d9c87b535b3
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
(cherry picked from commit 818b59b2292f87c3781a6f7a288d10e2453b0d13)
2018-04-16 09:30:29 -07:00
Suren Baghdasaryan efe582c34f lmkd: Rename is_go_device variable to better reflect its function
Rename is_go_device variable to low_ram_device to better reflect
its meaning and relation to ro.config.low_ram variable.

Bug: 77299493
Bug: 75322373
Change-Id: I6e2eaebe79cf2e6edf861f7c602e52a5b573ad0a
Merged-In: I6e2eaebe79cf2e6edf861f7c602e52a5b573ad0a
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
(cherry picked from commit fe2be6cc44073b7ef09ca849004e5072bdf18857)
2018-04-16 09:27:32 -07:00
Suren Baghdasaryan 518668e043 lmkd: Add lmkd README file
Add README file providing lmkd overview and description for its
properties.

Bug: 77299493
Bug: 75322373
Change-Id: I30236dd4ccaa2b48c31dfb80b63f0b82b49b5744
Merged-In: I30236dd4ccaa2b48c31dfb80b63f0b82b49b5744
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
(cherry picked from commit 7e5dea82a5a2f86117722ff11c93bc672ffb7903)
2018-04-16 09:26:40 -07:00
Florian Mayer 796de1cacb Merge commit '6499e5ec' into pi-dev-plus-aosp
am: 7725a9d9aa

Change-Id: Ia4fa295ffbcc520a00310fa1bbeef8e64aa671ef
2018-04-16 08:49:13 -07:00
Florian Mayer d138d4cdfc Merge commit '6499e5ec' into pi-dev-plus-aosp 2018-04-16 14:55:03 +01:00
Florian Mayer 00484817cc Merge commit '6499e5ec' 2018-04-16 11:21:27 +01:00
Suren Baghdasaryan 786e8537fa lmkd: Introduce support for legacy kill algorithm that uses minfree levels
Add ability to switch to the algorithm used by lowmemorykiller driver
for determining when to kill. It uses minfree levels to decide at which
levels of free memory and file cache to kill a process. oom_adj_score
is also determined by comparing current memory resources against minfree
levels.
ro.lmk.use_minfree_levels property is introduces for switching into this
mode. By default it is disabled.

Bug: 77299493
Bug: 75322373
Merged-In: I6b51972951026854a079fcda33d6786b7ed035e4
Change-Id: I6b51972951026854a079fcda33d6786b7ed035e4
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2018-04-15 16:02:36 +00:00
Suren Baghdasaryan 3bac7a1daf lmkd: Switch to using /proc/meminfo to have access to file cache size
Current mechanism of getting system memory state by using sysinfo()
is not enough because it does not provide information about file cache
size which is needed to correctly assess memory state. Switch to using
data from /proc/meminfo that includes information provided by sysinfo()
and file cache size in addition to that.


Bug: 77299493
Bug: 75322373
Merged-In: I16106fc4f9254f17f776803e60502b7b6474e1b7
Change-Id: I16106fc4f9254f17f776803e60502b7b6474e1b7
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2018-04-15 10:03:05 +00:00
Suren Baghdasaryan 65f04901ec lmkd: Introduce support for legacy kill algorithm that uses minfree levels
Add ability to switch to the algorithm used by lowmemorykiller driver
for determining when to kill. It uses minfree levels to decide at which
levels of free memory and file cache to kill a process. oom_adj_score
is also determined by comparing current memory resources against minfree
levels.
ro.lmk.use_minfree_levels property is introduces for switching into this
mode. By default it is disabled.

Bug: 77299493
Bug: 75322373
Change-Id: I6b51972951026854a079fcda33d6786b7ed035e4
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2018-04-15 02:29:57 -07:00
Suren Baghdasaryan 836c9168f0 lmkd: Switch to using /proc/meminfo to have access to file cache size
Current mechanism of getting system memory state by using sysinfo()
is not enough because it does not provide information about file cache
size which is needed to correctly assess memory state. Switch to using
data from /proc/meminfo that includes information provided by sysinfo()
and file cache size in addition to that.

Bug: 77299493
Bug: 75322373
Change-Id: I16106fc4f9254f17f776803e60502b7b6474e1b7
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2018-04-15 02:13:44 -07:00