Commit Graph

1373 Commits

Author SHA1 Message Date
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
Suren Baghdasaryan 7e0d65b65c 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
Merged-In: Ie7d80bbb81fd0d2fc0629f6f678e6afc97fed1f6
Change-Id: Ie7d80bbb81fd0d2fc0629f6f678e6afc97fed1f6
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2018-04-15 07:55:27 +00:00
Suren Baghdasaryan 8796674f2e 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
Merged-In: I8e27f8b9526e82e3cc313a02fce215c2e4dd3d29
Change-Id: I8e27f8b9526e82e3cc313a02fce215c2e4dd3d29
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2018-04-15 07:54:03 +00:00
Suren Baghdasaryan 207ed18611 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
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2018-04-14 23:50:14 -07:00
Suren Baghdasaryan 34c6cf2f40 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
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2018-04-14 23:50:00 -07:00
Suren Baghdasaryan fc2123fdcf Merge changes I78d2dc79,I6e2eaebe am: bb266150fe am: 4d41a1f882
am: 6607770968

Change-Id: I22db50c6e56549582dd8c8dfcda9794d3989a17c
2018-04-14 17:21:53 -07:00
Suren Baghdasaryan f7e6fd02a1 Merge "lmkd: Add lmkd README file" am: b518418fbb am: 29aca8b0be
am: 94b5686aca

Change-Id: I41ed8e67023a24deb2049b05818d234253bd5ac3
2018-04-14 16:44:00 -07:00
Suren Baghdasaryan 47b64460c0 Merge changes I78d2dc79,I6e2eaebe am: bb266150fe
am: 4d41a1f882

Change-Id: If65529061b6bd49c06b0eae37dd9e196fa805ab7
2018-04-14 16:25:15 -07:00
Suren Baghdasaryan c989cb1e2f Merge "lmkd: Add lmkd README file" am: b518418fbb
am: 29aca8b0be

Change-Id: I0153fae612008cc2fe75a1ae8f29c8c4fe90d4b8
2018-04-14 16:03:45 -07:00
Suren Baghdasaryan 36b2c497e3 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).

Change-Id: I78d2dc79d9c54e636c26665605518d9c87b535b3
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2018-04-13 23:24:24 +00:00
Suren Baghdasaryan d1d59f871f 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.

Change-Id: I6e2eaebe79cf2e6edf861f7c602e52a5b573ad0a
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2018-04-13 23:24:09 +00:00
Suren Baghdasaryan 14b4465450 lmkd: Add lmkd README file
Add README file providing lmkd overview and description for its
properties.

Change-Id: I30236dd4ccaa2b48c31dfb80b63f0b82b49b5744
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2018-04-13 21:36:44 +00:00
Mark Salyzyn 5cb238b41d resolve merge conflicts of f062a2cd9eef32ac9458faee7d056c06f2f4168b to pi-dev-plus-aosp
am: be5235619f

Change-Id: I5ac401c518af4240bb56d867fd10771b3ea1d0a2
2018-04-06 08:20:25 -07:00
Mark Salyzyn 9e918598df resolve merge conflicts of f062a2cd9eef32ac9458faee7d056c06f2f4168b to pi-dev-plus-aosp
Test: I solemnly swear I tested this conflict resolution.
Change-Id: I5eb1bc16bf25b27172b6d2ea355768df2f6d8ff7
2018-04-06 07:56:54 -07:00
Mark Salyzyn b9bd86aeaf Merge "lmkd: test: access /sys/module/lowmemorykiller/ as u:r:shell:s0" am: b69cb7071d am: 4f7d8851a5
am: aa0b84afca

Change-Id: I2b9848ada0bdff52179bebdda05b2695e8293994
2018-04-05 20:02:40 -07:00
Mark Salyzyn ef4b4be3a5 Merge "lmkd: test: access /sys/module/lowmemorykiller/ as u:r:shell:s0" am: b69cb7071d
am: 4f7d8851a5

Change-Id: I1ef7aab68bfb5a11891ef4777f6dc46774120a21
2018-04-05 19:45:16 -07:00
Mark Salyzyn 5cc80b3d98 lmkd: only mlockall() if enabled
Move process initialization, mlockall() and sched_setscheduler() to
only occur if initialization succeeds and is enabled.  This
conserves mlock'd memory and a FIFO processing slot if (deprecated)
kernel lowmemorykiller is active.

Cleanup: Android coding standard compliance.

Test: lmkd_unit_test
Bug: 33808187
Bug: 72838192
Change-Id: I51af0235c8eca4ef958ef2d83a8071ff58b49d78
2018-04-03 14:41:26 +00:00