Commit Graph

1329 Commits

Author SHA1 Message Date
Suren Baghdasaryan 61750b2ecc Merge "lmkd: Introduce system property to get minfree and oom_adj levels" am: ca2d03ebdb am: 4ca5f5be67
am: 4121aea7ac

Change-Id: I31a515121b68b6f7f74a96aac9bf80c205cad989
2018-09-05 21:22:47 -07:00
Suren Baghdasaryan 53be36e6d8 lmkd: rate-limit and cleanup failed kill reports
Excessive number of failed kill reports when lmkd can't find an eligible
process to kill or frees not enough memory pollutes logs and bugreports.
Cleanup kill reports to remove duplicate information and rate limit failed
kill attempts at 1 report per sec. The number of suppressed failed kills
will be reported in the next lmkd report.

Bug: 113864581
Test: Verified using lmkd_unit_test
Change-Id: I67fa1fec97613f136c7582115edcbc56b1503c9c
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2018-09-06 01:59:49 +00:00
Suren Baghdasaryan 3e81b52bb8 Merge "lmkd: Introduce system property to get minfree and oom_adj levels"
am: ca2d03ebdb

Change-Id: I8cfbfb8ec49336820692d04af6efc8adae23820d
2018-09-05 17:08:24 -07:00
Suren Baghdasaryan 1ed0db1a19 lmkd: Introduce system property to get minfree and oom_adj levels
Introduce sys.lmk.minfree_levels system property to allow minfree level
reporting. The format for this property is:

<minfree 1>:<oom_adj 1>, <minfree 2>:<oom_adj 2>, ...

Max number of minfree levels is 6 and they are specified in the
increasing order. For example:

sys.lmk.minfree_levels=18432:0,23040:100,27648:200,32256:300,55296:900,80640:906

sys.lmk.minfree_levels updates are ratelimited to once per second in order
to prevent DoS attacks.

Bug: 111521182
Test: getprop sys.lmk.minfree_levels returns expected value
Change-Id: I80d75d6836650b12457d6a99ca88898535837a97
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2018-09-05 10:54:22 -07:00
Vic Yang 209abafe0a Merge "lmkd: Do not downgrade/ignore events when swap is full" am: c48943165d am: a79d8384f1
am: 92e2212af0

Change-Id: I9857648f0803ac7356fb6e4b1963f26998837655
2018-08-14 19:59:50 -07:00
Vic Yang 19a9c239ba Merge "lmkd: Do not downgrade/ignore events when swap is full"
am: c48943165d

Change-Id: Id9497112443f9a11cbf2368dd10019359c4fc3ee
2018-08-14 16:10:18 -07:00
Treehugger Robot ac26903b12 Merge "lmkd: Do not downgrade/ignore events when swap is full" 2018-08-14 21:31:56 +00:00
Suren Baghdasaryan 050eeec93f Merge "lmkd: Add meminfo logging after each kill for easy troubleshooting" am: 7bb1ae2d88 am: e645496ecd am: 4b7f5af6c2
am: bbbc0c5ede

Change-Id: I07c6a260fe2cd65d294bd92f560d0fe339ebb7d4
2018-08-10 19:48:32 -07:00
Suren Baghdasaryan dcc35528fc Merge "lmkd: Add meminfo logging after each kill for easy troubleshooting"
am: 7bb1ae2d88

Change-Id: Ie54654d0dd35b9549b017a7e2d10b80536e4a3af
2018-08-10 18:57:09 -07:00
Suren Baghdasaryan 08bfa985d1 lmkd: Add meminfo logging after each kill for easy troubleshooting
While troubleshooting memory pressure related issues it's hard to get a
good view of the memory state when lmkd kill happens. Logging relevant
information from /proc/meminfo file that was used to make a kill decision
is very helpful for further analysis. To do this efficiently we are using
Android Logger event library functions and log the data used for kill
decision after the kill signal was issued.

Test: Run lmkd_unit_test and logcat -b events -v descriptive
Change-Id: Id5de41b9d91a04dd5d3eb9b85d4e1babe9755628
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2018-08-10 14:21:31 -07:00
Suren Baghdasaryan 6c60925290 [automerger skipped] Merge "lmkd: Skip memory.stat usage when per-app memcgs are not used" am: 1e0e1b44bd -s ours am: 42f5cfbd45 -s ours am: 6d066c9a4c -s ours
am: 297257295a  -s ours

Change-Id: I4b8a19e2cba6609ea691aa38f14ab9b602ea7b45
2018-08-08 19:48:48 -07:00
Suren Baghdasaryan b01837accd Merge "lmkd: Protect against buffer overflow" am: 41950dd414 am: 26beb5ca71 am: 904648c7dc
am: 47725e6afe

Change-Id: I1f4e363e6e09442f5d49ca59244c9d6afde7827e
2018-08-08 19:45:43 -07:00
Suren Baghdasaryan 456cdfd896 [automerger skipped] Merge "lmkd: Skip memory.stat usage when per-app memcgs are not used"
am: 1e0e1b44bd  -s ours

Change-Id: Ic2a13be530643b3b30c69587ec7dfbe76725474b
2018-08-08 11:38:50 -07:00
Vic Yang 65680690d7 lmkd: Do not downgrade/ignore events when swap is full
When the swap space is full, a pressure event is unlikely to resolve by
itself.  In this case, do not downgrade or ignore the events.

Bug: 112056451
Test: Fill up swap on a 1GB device and check critical vmpressure events
      are not downgraded.
Change-Id: If154dc364711bf7c86f32e24ddcd10be359386de
2018-08-08 10:00:06 -07:00
Suren Baghdasaryan 2f81a77326 lmkd: Skip memory.stat usage when per-app memcgs are not used
Initial change to remove memory.stat usage when per-application memcgs
are disabled was partially merged into AOSP under the following id:
Ib6dd7586d3ef1c64cb04d16e2d2b21fa9c8e6a3a
This change adds the missing parts.

Bug: 110384555
Change-Id: I1265021b1ede0e68efbf80d6430a959eaf46a69a
Merged-In: Ib6dd7586d3ef1c64cb04d16e2d2b21fa9c8e6a3a
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2018-08-08 01:18:38 +00:00
Greg Kaiser f5b1d14fa8 lmkd: Protect against buffer overflow
We're passing a 'line' whose backing buffer is PAGE_MAX in size
into memory_stat_parse_line().  We protect overflowing the smaller
LINE_MAX 'key' buffer via some C preprocessing macros to assure
we limit the size.

Test: Local build with LMKD_LOG_STATS set for this file.
Bug: 76220622
Change-Id: I9e50d4270f7099e37a9bfc7fb9b9b95cc7adb086
2018-08-07 15:42:19 -07:00
Suren Baghdasaryan e105afc6ba [automerger skipped] Merge "Enable lmkd kill tracing everywhere" am: e961bbcadc -s ours am: 5d95ac61d7 -s ours am: af1e0d7274 -s ours
am: d5b98ee1d7  -s ours

Change-Id: Ib2438e0f6bfa7c6350eeb00dd1c7987f544dc2cc
2018-08-03 11:18:38 -07:00
Suren Baghdasaryan 953a455938 [automerger skipped] Merge "Enable lmkd kill tracing everywhere"
am: e961bbcadc  -s ours

Change-Id: I8551e637d4aec87c75ff6079040d0cde1b8f248c
2018-08-03 10:58:06 -07:00
Suren Baghdasaryan 5a811c7e61 [automerger skipped] Merge "lmkd: Disable memory.stat usage when per-application memcgs are not used" am: 615745cead am: 9461708ec9 am: 768df3c344
am: 07a913046e  -s ours

Change-Id: I7f80d8ba552ad7554adcd205a15911d355eeb359
2018-08-03 09:27:45 -07:00
Suren Baghdasaryan 7dca058d60 Merge "lmkd: Disable memory.stat usage when per-application memcgs are not used"
am: 615745cead

Change-Id: I57f3142ed217d4f1b3edb526087076fc588354d7
2018-08-03 09:14:09 -07:00
Daniel Colascione 59e40dfd14 Enable lmkd kill tracing everywhere
Test: asdf
Exempt-From-Owner-Approval: vacation
Merged-In: If6af7df74d303466aac4a69cdfe558e9748f72b9
Change-Id: If6af7df74d303466aac4a69cdfe558e9748f72b9
2018-08-03 16:08:01 +00:00
Suren Baghdasaryan 8389fdbece 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
Merged-In: Ib6dd7586d3ef1c64cb04d16e2d2b21fa9c8e6a3a
Change-Id: Ib6dd7586d3ef1c64cb04d16e2d2b21fa9c8e6a3a
Signed-off-by: Minchan Kim <minchan@google.com>
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2018-08-03 16:06:54 +00:00
Chih-Hung Hsieh afa129c112 Merge "Declare __fake_use_va_args as a variadic function." am: e352a75b90 am: 7585d2270e am: bc7f7e7311
am: 044942e5b8

Change-Id: I72571e509dcda07ce4f2e36639523e23f5752146
2018-07-25 16:56:27 -07:00
Chih-Hung Hsieh 77f64e0509 Merge "Declare __fake_use_va_args as a variadic function."
am: e352a75b90

Change-Id: I4cfeb23cab215741944485baa47450115ed671e0
2018-07-25 16:44:45 -07:00
Chih-Hung Hsieh 234a5a0350 Declare __fake_use_va_args as a variadic function.
* New clang compiler requires variadic function to have
  at least one named parameter type.
* Use ##__VA_ARGS__ to work with empty __VA_ARGS__.
* Fix one ALOG_ASSERT parameter bug in lmkd/lmkd.c.

Bug: 111614304
Test: make with WITH_TIDY=1
Change-Id: I90f35aa88527a6897954f69a35b256a157a725c5
2018-07-25 14:36:35 -07:00
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