diff options
Diffstat (limited to 'en/devices')
-rw-r--r-- | en/devices/_toc-performance.yaml | 2 | ||||
-rw-r--r-- | en/devices/architecture/hidl/services.html | 17 | ||||
-rw-r--r-- | en/devices/tech/connect/carrier-wifi.md | 53 | ||||
-rw-r--r-- | en/devices/tech/perf/lmkd.md | 197 |
4 files changed, 252 insertions, 17 deletions
diff --git a/en/devices/_toc-performance.yaml b/en/devices/_toc-performance.yaml index 83f31408..174534dd 100644 --- a/en/devices/_toc-performance.yaml +++ b/en/devices/_toc-performance.yaml @@ -11,6 +11,8 @@ toc: path: /devices/tech/perf/apk-caching - title: Boot Times path: /devices/tech/perf/boot-times +- title: LMKD in Userspace + path: /devices/tech/perf/lmkd - title: Low RAM path: /devices/tech/perf/low-ram - title: Profile Guided Optimization (PGO) diff --git a/en/devices/architecture/hidl/services.html b/en/devices/architecture/hidl/services.html index c7ddd8f6..f441c8e2 100644 --- a/en/devices/architecture/hidl/services.html +++ b/en/devices/architecture/hidl/services.html @@ -168,14 +168,15 @@ or <code>oneway</code>. For an example, see "Asynchronous callbacks" in <code>inout</code> parameters.</p> <h3 id=limits>Per-transaction limits</h3> -<p>Per-transaction limits may be imposed on the amount of data sent in HIDL -methods and callbacks. The limits are yet to be determined but may be as small -as 4K. Calls exceeding these limits return failure immediately. Another -limitation is the resources available to the HIDL infrastructure to handle -multiple simultaneous transactions. Multiple transactions can be in-flight -simultaneously due to multiple threads or processes sending calls to a process -or multiple <code>oneway</code> calls that are not handled quickly by the -receiving process.</p> +<p>Per-transaction limits are not imposed on the amount of data sent in HIDL +methods and callbacks. However, calls exceeding 4KB per transaction are +considered excessive. If this is seen, re-architecting the given HIDL interface +is recommended. Another limitation is the resources available to the HIDL +infrastructure to handle multiple simultaneous transactions. Multiple +transactions can be in-flight simultaneously due to multiple threads or +processes sending calls to a process or multiple <code>oneway</code> calls that +are not handled quickly by the receiving process. The maximum total space +available for all concurrent transactions is 1MB by default.</p> <p>In a well-designed interface, exceeding these resource limitations should not happen; if it does, the call which exceeded them may either block until diff --git a/en/devices/tech/connect/carrier-wifi.md b/en/devices/tech/connect/carrier-wifi.md index be25f4b9..9e96c391 100644 --- a/en/devices/tech/connect/carrier-wifi.md +++ b/en/devices/tech/connect/carrier-wifi.md @@ -34,15 +34,50 @@ Wi-Fi. ### Manufacturers -In the carrier config manager, configure the following parameters, located in -[`CarrierConfigManager.java`](https://android.googlesource.com/platform/frameworks/base/+/master/telephony/java/android/telephony/CarrierConfigManager.java){: .external}, -for each carrier: - -+ `KEY_CARRIER_WIFI_STRING_ARRAY`: Base64-encoded Wi-Fi SSID. -+ `IMSI_KEY_AVAILABILITY_INT`: Identifies whether the key used for IMSI - encryption is available for WLAN or EPDG, or both. -+ `IMSI_KEY_DOWNLOAD_URL_STRING`: URL from which the proto containing the - public key of the carrier used for IMSI encryption is downloaded. +In the carrier config manager, configure the following parameters for each +carrier: + ++ [`KEY_CARRIER_WIFI_STRING_ARRAY`](https://android.googlesource.com/platform/frameworks/base/+/master/telephony/java/android/telephony/CarrierConfigManager.java#1606){: .external}: + A string array where each string entry is a Base64-encoded Wi-Fi SSID and + an EAP type separated by a comma, where the EAP type is an integer (refer to + [https://www.iana.org/assignments/eap-numbers/eap-numbers.xhtml](https://www.iana.org/assignments/eap-numbers/eap-numbers.xhtml){: .external}). + For example, the following configuration is for *SOME_SSID_NAME* using + **EAP-AKA** and *Some_Other_SSID* using **EAP-SIM**: + + ``` + config { + key: "carrier_wifi_string_array" + text_array { + item: "U09NRV9TU0lEX05BTUUK,23" + item: "U29tZV9PdGhlcl9TU0lECg==,18" + } + } + ``` + ++ [`IMSI_KEY_AVAILABILITY_INT`](https://android.googlesource.com/platform/frameworks/base/+/master/telephony/java/android/telephony/CarrierConfigManager.java#1837){: .external}: + Identifies whether the key used for IMSI encryption is available for WLAN + (bit 1 is set), EPDG (bit 0 is set), or both (both bit 0 and bit 1 are + set). For example, the following configuration indicates that IMSI + encryption is available for WLAN but not for EPDG: + + ``` + config { + key: "imsi_key_availability_int" + int_value: 2 + } + ``` + ++ [`IMSI_KEY_DOWNLOAD_URL_STRING`](https://android.googlesource.com/platform/frameworks/base/+/master/telephony/java/android/telephony/CarrierConfigManager.java#1830){: .external}: + URL from which the proto containing the public key of the carrier used for + IMSI encryption is downloaded. For example, the following configuration + provides a specific URL: + + ``` + config { + key: "imsi_key_download_url_string" + text_value: "https://www.some_company_name.com:5555/some_directory_name/" + } + ``` ### Carriers diff --git a/en/devices/tech/perf/lmkd.md b/en/devices/tech/perf/lmkd.md new file mode 100644 index 00000000..72ff452b --- /dev/null +++ b/en/devices/tech/perf/lmkd.md @@ -0,0 +1,197 @@ +Project: /_project.yaml +Book: /_book.yaml + +{% include "_versions.html" %} + +<!-- + Copyright 2018 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +# LMKD in Userspace + +This document describes the userspace lowmemorykiller daemon (`lmkd`) features +added in Android {{ androidPVersionNumber }} and how to configure them. + +Historically, Android used in-kernel lowmemorykiller driver to handle memory +pressure situations by killing non-essential processes. This mechanism is rigid +and depends on hard-coded values. In addition, starting with kernel 4.12, the +lowmemorykiller driver is excluded from the upstream kernel. + +The userspace `lmkd` process implements the same functionality but with already +existing kernel mechanisms to detect and estimate memory pressure. It uses +vmpressure events generated by the kernel to get notifications about memory +pressure levels. It also can use memory cgroup features to limit memory resources +allocated to each process based on its importance. + + +# How to switch to userspace lmkd + +Starting in Android {{ androidPVersionNumber }}, userspace `lmkd` activates if an +in-kernel lowmemorykiller driver is not detected. Note that userspace `lmkd` +requires kernel support for memory cgroups. Therefore, to switch to userspace +`lmkd` the kernel should be compiled with the following configuration settings: + +``` +CONFIG_ANDROID_LOW_MEMORY_KILLER=n +CONFIG_MEMCG=y +CONFIG_MEMCG_SWAP=y +``` + +# lmkd kill strategies + +`lmkd` supports new kill strategies based on vmpressure events, their severity, +and other hints like swap utilization, as well as legacy mode in which `lmkd` +makes kill decisions just as the kernel lowmemorykiller driver did. + +New kill strategies differ for low-memory vs high-performance devices. In cases +of low-memory devices, the system should tolerate higher memory pressure as a +normal mode of operation; on high-performance devices, memory pressure should be +viewed as an abnormal situation that should be fixed before it affects overall +performance. The `ro.config.low_ram` property allows for choosing one mode over +the other. See [Low RAM Configuration](/devices/tech/perf/low-ram) for +instructions on setting this property. + +In legacy mode, `lmkd` kill decisions are made based on free memory and file cache +thresholds. This mode is enabled by setting the `ro.lmk.use_minfree_levels` +property to `true`. + + +# Configuring lmkd for specific device + +Configure `lmkd` with the following properties: + +<table> + <tr> + <th>Property</th> + <th>Use</th> + <th>Default Value</th> + </tr> + <tr> + <td><code>ro.config.low_ram</code> + </td> + <td>Choose between low-memory vs. high-performance device. + </td> + <td><code>false</code> + </td> + </tr> + <tr> + <td><code>ro.lmk.use_minfree_levels</code> + </td> + <td>Use free memory and file cache thresholds for making decisions when to + kill. This mode works the same way kernel lowmemorykiller driver used to + work. + </td> + <td><code>false</code> + </td> + </tr> + <tr> + <td><code>ro.lmk.low</code> + </td> + <td>The minimum oom_adj score for processes eligible to be killed at low + vmpressure level. + </td> + <td><code>1001</code><br> +(disabled) + </td> + </tr> + <tr> + <td><code>ro.lmk.medium</code> + </td> + <td>The minimum oom_adj score for processes eligible to be killed at medium + vmpressure level. + </td> + <td><code>800</code><br> +(cached or non-essential services) + </td> + </tr> + <tr> + <td><code>ro.lmk.critical</code> + </td> + <td>The minimum oom_adj score for processes eligible to be killed at critical + vmpressure level. + </td> + <td><code>0</code><br> +(any process) + </td> + </tr> + <tr> + <td><code>ro.lmk.critical_upgrade</code> + </td> + <td>Enables upgrade to critical level. + </td> + <td><code>false</code> + </td> + </tr> + <tr> + <td><code>ro.lmk.upgrade_pressure</code> + </td> + <td>The maximum mem_pressure at which level will be upgraded because system + is swapping too much. + </td> + <td><code>100</code><br> +(disabled) + </td> + </tr> + <tr> + <td><code>ro.lmk.downgrade_pressure</code> + </td> + <td>The minimum mem_pressure* at which vmpressure event will be ignored + because enough free memory is still available. + </td> + <td><code>100</code><br> +(disabled) + </td> + </tr> + <tr> + <td><code>ro.lmk.kill_heaviest_task</code> + </td> + <td>Kill heaviest eligible task (best decision) vs. any eligible task (fast + decision).</td> + <td><code>true</code> + </td> + </tr> + <tr> + <td><code>ro.lmk.kill_timeout_ms</code> + </td> + <td>Duration in ms after a kill when no additional kill will be done. + </td> + <td><code>0</code><br> +(disabled) + </td> + </tr> + <tr> + <td><code>ro.lmk.debug</code> + </td> + <td>Enable <code>lmkd</code> debug logs. + </td> + <td><code>false</code> + </td> + </tr> +</table> + +*Note: *mem_pressure = RAM usage / RAM_and_swap usage in % + +Here is a device configuration example: + +``` +PRODUCT_PROPERTY_OVERRIDES += \ + ro.lmk.low=1001 \ + ro.lmk.medium=800 \ + ro.lmk.critical=0 \ + ro.lmk.critical_upgrade=false \ + ro.lmk.upgrade_pressure=100 \ + ro.lmk.downgrade_pressure=100 \ + ro.lmk.kill_heaviest_task=true +``` |