Commit Graph

529 Commits

Author SHA1 Message Date
Suren Baghdasaryan 8a32051ccf [automerger skipped] lmkd: polling code cleanup am: 3f84a211e5 -s ours am: 3c092ca721 -s ours
am skip reason: Change-Id If0674eda954a25f0f6c9188501ff77db8ba0813b with SHA-1 9ca5334683 is in history

Change-Id: I406ea70ae399a248ba0ab57f04e0200a83c3b08f
2020-05-20 00:54:03 +00:00
Suren Baghdasaryan 3c092ca721 [automerger skipped] lmkd: polling code cleanup am: 3f84a211e5 -s ours
am skip reason: Change-Id If0674eda954a25f0f6c9188501ff77db8ba0813b with SHA-1 9ca5334683 is in history

Change-Id: I65d3c8f3f36cec703fb60bf44e7f098369ce9bf3
2020-05-20 00:28:34 +00:00
Suren Baghdasaryan 3f84a211e5 lmkd: polling code cleanup
- Remove unused POLLING_STOP state
- Simplify POLLING_DO_NOT_CHANGE state handling
- Correct last_poll_tm assignment logic

Bug: 147315292
Test: lmkd_unit_test
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Merged-In: If0674eda954a25f0f6c9188501ff77db8ba0813b
Change-Id: If0674eda954a25f0f6c9188501ff77db8ba0813b
2020-05-19 15:50:18 -07:00
Kyeongdon Kim 4dfdb42e92 lmkd: fix type warning from static analysis tools am: 65857db6a9 am: c93040a423 am: 63f45b46d6
Change-Id: I38a74decb492f3f3fbf0fd2484a0c2d1060719fa
2020-05-12 20:41:50 +00:00
Kyeongdon Kim 63f45b46d6 lmkd: fix type warning from static analysis tools am: 65857db6a9 am: c93040a423
Change-Id: I67b40b195018c4da66b3bd7e375b0228412fcbc2
2020-05-12 20:22:31 +00:00
Kyeongdon Kim c93040a423 lmkd: fix type warning from static analysis tools am: 65857db6a9
Change-Id: Ie174a997b4f41b0d582893182b15039d8638f9ee
2020-05-12 20:09:12 +00:00
Kyeongdon Kim 65857db6a9 lmkd: fix type warning from static analysis tools
In memcg process stat path,
%u in format string (no.2) requires 'unsigned int'
but the argument type is 'signed int'.

Bug: NA
Test: check statslog with lmkd operation
Signed-off-by: Kyeongdon Kim <kyeongdon.kim@lge.com>
Change-Id: I3fcee57efbf26724878a81c8e1acd419aab8b95b
2020-05-12 19:56:46 +00:00
Suren Baghdasaryan 53dad9cddd lmkd: Enable stricter compiler checks am: e538ba2df6 am: 38855fe192 am: 8e064f1260
Change-Id: Ic18ac4b6bda1fb4b036a68499b21b57c6100f884
2020-05-12 19:50:08 +00:00
Suren Baghdasaryan 5de46f6109 lmkd: Remove unused variables and fix type mismatches am: ed715a3424 am: 8fa0ac5c64 am: 9fad9a82c7
Change-Id: Ief5e642d3ba5cf52a57dcfb5cdb931ea239fb578
2020-05-12 19:50:06 +00:00
Suren Baghdasaryan 8e064f1260 lmkd: Enable stricter compiler checks am: e538ba2df6 am: 38855fe192
Change-Id: Ifc5b0fae35155aabee00007609296a11bfb8e855
2020-05-12 19:36:13 +00:00
Suren Baghdasaryan 9fad9a82c7 lmkd: Remove unused variables and fix type mismatches am: ed715a3424 am: 8fa0ac5c64
Change-Id: I8477920456afad113a20c0053c88d69463689d30
2020-05-12 19:36:12 +00:00
Suren Baghdasaryan 38855fe192 lmkd: Enable stricter compiler checks am: e538ba2df6
Change-Id: Ife625c2ab0886cd9333269edb92d5e39447b15f8
2020-05-12 19:19:55 +00:00
Suren Baghdasaryan 8fa0ac5c64 lmkd: Remove unused variables and fix type mismatches am: ed715a3424
Change-Id: Ibcce20a6b9d724e102740683df45a16a0dfb3708
2020-05-12 19:19:53 +00:00
Suren Baghdasaryan e538ba2df6 lmkd: Enable stricter compiler checks
Enable -Wall and -Wextra compiler flags to catch compilation warnings.

Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: Ia802dbd7abb167d66b76390e269e4a4418ca5def
2020-05-12 02:56:41 +00:00
Suren Baghdasaryan ed715a3424 lmkd: Remove unused variables and fix type mismatches
Fix compilation warnings by removing unused variables and add typecasting
whenever mixed type comparisons are performed.

Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: I7f0839d803a6bf6532f077208ce54aba761dc9fe
2020-05-11 19:52:52 -07:00
Suren Baghdasaryan 46bb94d5e9 [automerger skipped] lmkd: Add property re-initialization support am: c4081918a7 am: a84a5e5801 -s ours
am skip reason: Change-Id Ic60331f3368f5a7fdfe09ad7d47c7ccf0a497685 with SHA-1 c4081918a7 is in history

Change-Id: I076eb3d336076fa64c8b6a863d6ef1043a51bc2c
2020-05-08 22:40:13 +00:00
Suren Baghdasaryan a84a5e5801 lmkd: Add property re-initialization support am: c4081918a7
Change-Id: I538cee8d0825d61ad5283e8a504e8cc74e5aa69a
2020-05-08 22:24:38 +00:00
Suren Baghdasaryan 2fe36b0246 [automerger skipped] lmkd: Add property re-initialization support am: c4081918a7 -s ours am: 350685e461 -s ours
am skip reason: Change-Id Ic60331f3368f5a7fdfe09ad7d47c7ccf0a497685 with SHA-1 1d0ebeaa9c is in history

Change-Id: I2a3b1c355edbdbe56e7036273d8398f6354ef309
2020-05-08 17:55:35 +00:00
Suren Baghdasaryan 350685e461 [automerger skipped] lmkd: Add property re-initialization support am: c4081918a7 -s ours
am skip reason: Change-Id Ic60331f3368f5a7fdfe09ad7d47c7ccf0a497685 with SHA-1 1d0ebeaa9c is in history

Change-Id: Ia0eb7d23137c74f72b251034902fd0ed9faf8a28
2020-05-08 17:40:35 +00:00
Suren Baghdasaryan c4081918a7 lmkd: Add property re-initialization support
Add --reinit command-line option to allow updating lmkd properties. For
example to enable debug logging in the running lmkd process user should
issue:

setprop ro.lmk.debug true
lmkd --reinit

Bug: 155149944
Test: lmkd_unit_test after resetting lmkd properties
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Merged-In: Ic60331f3368f5a7fdfe09ad7d47c7ccf0a497685
Change-Id: Ic60331f3368f5a7fdfe09ad7d47c7ccf0a497685
2020-05-07 09:46:42 -07:00
Suren Baghdasaryan d0c3babb02 lmkd: Add property re-initialization support am: 1d0ebeaa9c am: 4434ef0223 am: 2a5c69f8ee
Change-Id: Id49df1df06d69f2908936acbcbea373dd05fadd2
2020-05-07 16:28:44 +00:00
Suren Baghdasaryan 2a5c69f8ee lmkd: Add property re-initialization support am: 1d0ebeaa9c am: 4434ef0223
Change-Id: I06dcc993601d96ae61a233f3f6538ce9d2062221
2020-05-07 16:14:55 +00:00
Suren Baghdasaryan 4434ef0223 lmkd: Add property re-initialization support am: 1d0ebeaa9c
Change-Id: I0d29bf11bb96a7b97174a0def2753ea169835802
2020-05-07 16:00:43 +00:00
Suren Baghdasaryan 1d0ebeaa9c lmkd: Add property re-initialization support
Add --reinit command-line option to allow updating lmkd properties. For
example to enable debug logging in the running lmkd process user should
issue:

setprop ro.lmk.debug true
lmkd --reinit

Bug: 155149944
Test: lmkd_unit_test after resetting lmkd properties
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: Ic60331f3368f5a7fdfe09ad7d47c7ccf0a497685
2020-05-06 15:05:04 -07:00
Suren Baghdasaryan 2a25a29fd3 lmkd: enable ro.lmk.kill_timeout_ms to be used with kill notifications am: 03dccf35a1 am: d77a36e91b am: 3967548543
Change-Id: I96828260f5dfffdc6bdf23ec15171897798c4cac
2020-04-30 00:49:05 +00:00
Suren Baghdasaryan 3e6ec02346 lmkd: polling code cleanup am: 9ca5334683 am: 63123e1b84 am: f548154e2f
Change-Id: Id9a64fd393447d78fc5013f76c9c5a77e6cbf0c2
2020-04-30 00:49:00 +00:00
Suren Baghdasaryan 4183861521 lmkd: add kill when swap utilization is too high am: 51ee4c505f am: 45737af035 am: 1e7908dbc7
Change-Id: Ifce2f0c3b0584f5b7466704f60a9dde86db3b616
2020-04-30 00:48:48 +00:00
Suren Baghdasaryan 3967548543 lmkd: enable ro.lmk.kill_timeout_ms to be used with kill notifications am: 03dccf35a1 am: d77a36e91b
Change-Id: Ib92ac62009b7cefa3e265c29278080fabb51fb71
2020-04-30 00:33:25 +00:00
Suren Baghdasaryan f548154e2f lmkd: polling code cleanup am: 9ca5334683 am: 63123e1b84
Change-Id: I584542e05a7facac1c41c81549d31cd3edcdc2d4
2020-04-30 00:33:19 +00:00
Suren Baghdasaryan 1e7908dbc7 lmkd: add kill when swap utilization is too high am: 51ee4c505f am: 45737af035
Change-Id: Id06d5db6fa0ec9f7c15247afd4e6b558264080f9
2020-04-30 00:33:12 +00:00
Suren Baghdasaryan d77a36e91b lmkd: enable ro.lmk.kill_timeout_ms to be used with kill notifications am: 03dccf35a1
Change-Id: I564cf2f1f21481b13f53df0606d03226c444ef19
2020-04-30 00:17:07 +00:00
Suren Baghdasaryan 63123e1b84 lmkd: polling code cleanup am: 9ca5334683
Change-Id: I4cf6a8f55d9fc127d80686c07ce2893f3146f0da
2020-04-30 00:17:01 +00:00
Suren Baghdasaryan 45737af035 lmkd: add kill when swap utilization is too high am: 51ee4c505f
Change-Id: If8e5648ae6965d1f26c0032aa0ca548695d2b33f
2020-04-30 00:16:54 +00:00
Suren Baghdasaryan 03dccf35a1 lmkd: enable ro.lmk.kill_timeout_ms to be used with kill notifications
Allow lmkd to stop waiting for a kill notification if a kill takes longer
than ro.lmk.kill_timeout_ms.

Bug: 147315292
Test: lmkd_unit_test with ro.lmk.kill_timeout_ms set to 100
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: Ia3eed3448fd6928a5e634c2737044722048b3578
2020-04-29 15:11:36 -07:00
Suren Baghdasaryan 9ca5334683 lmkd: polling code cleanup
- Remove unused POLLING_STOP state
- Simplify POLLING_DO_NOT_CHANGE state handling
- Correct last_poll_tm assignment logic

Bug: 147315292
Test: lmkd_unit_test
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: If0674eda954a25f0f6c9188501ff77db8ba0813b
2020-04-29 15:11:15 -07:00
Suren Baghdasaryan 51ee4c505f lmkd: add kill when swap utilization is too high
When non-swappable allocations cause memory pressure swap will not be
depleted, however a high percentage of the swappable memory will be
pushed into swap. Detect this condition and kill a process when swap
utilization is too high while under memory pressure.
Introduce ro.lmk.swap_util_max property to represent max percentage of
the overall swappable memory that can be swapped under memory pressure
without triggering a kill. ro.lmk.swap_util_max is set to 100 by default
which disables kills due to the swap utilization.

Bug: 147315292
Test: ION memory hogger with ro.lmk.swap_util_max set to 95
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: I6dbf124bb24b220d136e8f16b3dae0c0c30d32ca
2020-04-29 15:11:02 -07:00
Tom Cherry d1c4ac96a7 Include what you use: <stdio.h> and <unistd.h> am: 24b31dced5 am: e3858891a4 am: d61445c93c
Change-Id: I4660e2db228da7c94503a8a9c40a3e49410cd8df
2020-04-14 02:10:33 +00:00
Tom Cherry d61445c93c Include what you use: <stdio.h> and <unistd.h> am: 24b31dced5 am: e3858891a4
Change-Id: I166eae5deb927ea9934266a4f31e341d248287d8
2020-04-14 01:48:24 +00:00
Tom Cherry e3858891a4 Include what you use: <stdio.h> and <unistd.h> am: 24b31dced5
Change-Id: Id5cebf4c2e8e268d8b64c30c02cc5265190677ca
2020-04-14 01:13:01 +00:00
Tom Cherry 24b31dced5 Include what you use: <stdio.h> and <unistd.h>
These were transitively included, but no longer are, so they must be
explicitly included.

Exempt-From-Owner-Approval: Janitorial
Test: build
Change-Id: Ic0896401d148b22f33d6edb1fac377208e437565
2020-04-13 15:21:09 -07:00
Tom Cherry ca7ea3be51 Include what you use: <fcntl.h> am: 0ebe6800bc am: 8ba967fb30 am: 54122bb8e0
Change-Id: I89435224ea9ff8dbbadd8c88095c776a679f6125
2020-04-13 20:18:08 +00:00
Tom Cherry 54122bb8e0 Include what you use: <fcntl.h> am: 0ebe6800bc am: 8ba967fb30
Change-Id: I9d30d9bac9ad386ed429767b99106632d158cada
2020-04-13 19:55:59 +00:00
Tom Cherry 8ba967fb30 Include what you use: <fcntl.h> am: 0ebe6800bc
Change-Id: I9cec3a4d2e00e996880beaaacf55d74a12f6a016
2020-04-13 19:36:16 +00:00
Tom Cherry 0ebe6800bc Include what you use: <fcntl.h>
This was transitively included, but no longer is, so it must be
explicitly included.

Exempt-From-Owner-Approval: Janitorial
Test: build
Change-Id: I89657fa33df4bc0f92685012b3ab9b24d55d1619
2020-04-13 11:10:12 -07:00
Xin Li ab5d7ae1cc [automerger skipped] DO NOT MERGE - Empty merge qt-qpr1-dev-plus-aosp into stag-aosp-master am: ee05bc2f99 -s ours am: c4f5136d3c
Change-Id: Ic3a916f56bd63a55c94614ba170ddce657b3634f
2020-04-10 03:59:03 +00:00
Xin Li c4f5136d3c [automerger skipped] DO NOT MERGE - Empty merge qt-qpr1-dev-plus-aosp into stag-aosp-master am: ee05bc2f99 -s ours
am skip reason: subject contains skip directive

Change-Id: I5975ea07816b991f07523d18008fdf68e0e321c6
2020-04-10 03:26:14 +00:00
Xin Li ee05bc2f99 DO NOT MERGE - Empty merge qt-qpr1-dev-plus-aosp into stag-aosp-master
Bug: 151763422
Change-Id: I4d701ead7b0d88ae89575f79844557290e109f66
2020-04-09 17:51:29 -07:00
Xin Li 9b008feec7 [automerger skipped] DO NOT MERGE - Empty merge qt-qpr1-dev-plus-aosp@6304901 into stag-aosp-master am: a28018dcb9 -s ours am: cb4c05feaa
Change-Id: I9112a0c0703d382e6710fe7d6226b782e2a93b13
2020-03-19 04:38:37 +00:00
Xin Li 3313cbce58 DO NOT MERGE - Empty merge qt-qpr1-dev-plus-aosp@6304901 into stag-aosp-master am: a28018dcb9
Change-Id: I38113dd9d2071de5be0e90bab55297d00a5b5d35
2020-03-19 04:22:52 +00:00
Xin Li cb4c05feaa [automerger skipped] DO NOT MERGE - Empty merge qt-qpr1-dev-plus-aosp@6304901 into stag-aosp-master am: a28018dcb9 -s ours
am skip reason: subject contains skip directive

Change-Id: I499b013b1a9147811123a328ec99c3dbde5f3011
2020-03-19 04:19:45 +00:00