Commit Graph

1104 Commits

Author SHA1 Message Date
Suren Baghdasaryan 922b24b93c lmkd: Disable memory.stat usage when per-application memcgs are not used
Per-application memory.stat files are not available when per-application
memcgs are not used (per_app_memcg=false). Disable its usage based on
ro.config.per_app_memcg property.

minchan:
* correct indentation of memory_stat_parse
* move per_app_memcg check into memory_stat_parse inside
* change low_ram_device to per_app_memcg

Bug: 110384555
Test: manual test to see lkmd log message with memory hogger
Change-Id: Ib6dd7586d3ef1c64cb04d16e2d2b21fa9c8e6a3a
Signed-off-by: Minchan Kim <minchan@google.com>
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2018-06-21 10:36:55 +09:00
Suren Baghdasaryan cfdfbfd064 [automerger skipped] Merge "lmkd: Do not set soft_limit_in_bytes on high-end devices" am: 827de19932 am: a7084943c9 -s ours
am: 3a77313c9f  -s ours

Change-Id: I3a9606c7a0d4292568aa0955042df26247b8cf57
2018-05-22 12:32:24 -07:00
Suren Baghdasaryan 2aa6bbb5d0 [automerger skipped] Merge "lmkd: Do not set soft_limit_in_bytes on high-end devices" am: 827de19932
am: a7084943c9  -s ours

Change-Id: Ibdc4154eca3340facc2702e749af3e540d0c05f8
2018-05-22 12:20:21 -07:00
Suren Baghdasaryan fe78b931fa lmkd: Do not set soft_limit_in_bytes on high-end devices
Setting memory.soft_limit_in_bytes on high-end devices with large memory
reserves affects performance of memory-hungry applications that have
large workingsets and keep thrashing because of the memory limits imposed.
Limit the usage of memory.soft_limit_in_bytes to low-memory devices only.
Add debug messages for future troubleshooting to capture cases when
vmpressure events are being ignored.

Bug: 78916015
Test: collect vmstat while running a heavy app
Change-Id: Ib4434b96d2be802ef89960b573486eae8d12f198
Merged-In: Ib4434b96d2be802ef89960b573486eae8d12f198
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2018-05-22 10:25:38 -07:00
android-build-team Robot f4a8a1aa26 Snap for 4796401 from 93d48fe0b6e891d785caefdc02065da58e749c69 to pi-release
Change-Id: I9d5a3d4d48b6944b00e032511151eb1a4a391d4b
2018-05-22 07:27:05 +00:00
Suren Baghdasaryan b3bddfa598 Merge "resolve merge conflicts of 20686f061eebddb7d49d9a061fc736dad0b96c93 to pi-dev-plus-aosp" into pi-dev-plus-aosp
am: bbda5b6092

Change-Id: I516dae0e97658f8c340d63f6bcc262734c8400bc
2018-05-21 22:07:21 -07:00
Suren Baghdasaryan bf919ff222 resolve merge conflicts of 20686f061eebddb7d49d9a061fc736dad0b96c93 to pi-dev-plus-aosp
BUG: None
Test: I solemnly swear I tested this conflict resolution.
Change-Id: I02b5973366351604bf46df7ad4e2235b1dda014a
2018-05-21 19:48:47 -07:00
Suren Baghdasaryan b0bda55c12 lmkd: Do not set soft_limit_in_bytes on high-end devices
Setting memory.soft_limit_in_bytes on high-end devices with large memory
reserves affects performance of memory-hungry applications that have
large workingsets and keep thrashing because of the memory limits imposed.
Limit the usage of memory.soft_limit_in_bytes to low-memory devices only.
Add debug messages for future troubleshooting to capture cases when
vmpressure events are being ignored.

Bug: 78916015
Test: collect vmstat while running a heavy app
Change-Id: Ib4434b96d2be802ef89960b573486eae8d12f198
Merged-In: Ib4434b96d2be802ef89960b573486eae8d12f198
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2018-05-21 23:17:46 +00:00
Suren Baghdasaryan 4671c3d9c4 lmkd: Do not set soft_limit_in_bytes on high-end devices
Setting memory.soft_limit_in_bytes on high-end devices with large memory
reserves affects performance of memory-hungry applications that have
large workingsets and keep thrashing because of the memory limits imposed.
Limit the usage of memory.soft_limit_in_bytes to low-memory devices only.
Add debug messages for future troubleshooting to capture cases when
vmpressure events are being ignored.

Bug: 78916015
Test: collect vmstat while running a heavy app
Change-Id: Ib4434b96d2be802ef89960b573486eae8d12f198
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2018-05-21 14:42:15 -07:00
android-build-team Robot f73aab11e7 Snap for 4787078 from 7905b1e16286653679b7ff9b595f3ed7de5e182f to pi-release
Change-Id: Id0a5125ffd734a0b158ab867f8ffd9c0e0ae930a
2018-05-17 07:22:36 +00:00
Yang Lu 8c224cca69 Merge "Only log the lmkd state change when the killing really happened." into pi-dev am: 7905b1e162
am: 45695becc5

Change-Id: I63f288d064b896ae16908035f41fed3346154daa
2018-05-16 09:17:19 -07:00
Yang Lu caf318e0f7 Merge "Only log the lmkd state change when the killing really happened." into pi-dev
am: 7905b1e162

Change-Id: I2abda8ab40e766c882bdd8746bdf21bc222e7c50
2018-05-16 09:12:41 -07:00
Yang Lu 5dfffbc7a9 Only log the lmkd state change when the killing really happened.
BUG: b/78603347

Test: statsd test

Change-Id: I0345a47e1cd1c79a67103e401a2eb0a7fbe0631b
2018-05-15 16:54:45 +00:00
android-build-team Robot 786a5e0f4a Snap for 4781566 from 09b309807ff4cbf53545749dabbfe2838a1755ff to pi-release
Change-Id: I792bce225a67d61a24674a71b8db05bb9486aad7
2018-05-15 07:26:06 +00:00
Dan Willemsen 6e24015a96 Revert "Only log the lmkd state change when the killing really happened." am: 0051684905
am: 971f23bf66

Change-Id: Ia57c8d7e63c538442780fa20809c886a3af31941
2018-05-14 20:35:38 -07:00
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