summaryrefslogtreecommitdiff
path: root/core/java
diff options
context:
space:
mode:
authorAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2020-01-03 01:15:50 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2020-01-03 01:15:50 +0000
commit6dfd9358a3c69acff2fc4594db2470ca8f3fc8b6 (patch)
tree095bab1ea1507845f8beb5cba8e5b92d98885c54 /core/java
parent71d5f85ea38f0a21184a6f96be2fe5827144f42d (diff)
parenta457a78ab7931ad2c9478fcb1cadbb78dcfe863d (diff)
Merge "Prevent double-counting of kernel stack size in dumpsys reports" am: 9493f0ed0b am: a457a78ab7
Change-Id: I5454c8a0c92bd8b25956cf96b987199fffe3a898
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/os/Debug.java8
-rw-r--r--core/java/com/android/internal/util/MemInfoReader.java9
2 files changed, 14 insertions, 3 deletions
diff --git a/core/java/android/os/Debug.java b/core/java/android/os/Debug.java
index 422761c4dca5..d7ed05577697 100644
--- a/core/java/android/os/Debug.java
+++ b/core/java/android/os/Debug.java
@@ -2526,4 +2526,12 @@ public final class Debug
* @hide
*/
public static native long getIonMappedSizeKb();
+
+ /**
+ * Return whether virtually-mapped kernel stacks are enabled (CONFIG_VMAP_STACK).
+ * Note: caller needs config_gz read sepolicy permission
+ *
+ * @hide
+ */
+ public static native boolean isVmapStack();
}
diff --git a/core/java/com/android/internal/util/MemInfoReader.java b/core/java/com/android/internal/util/MemInfoReader.java
index 362bc92e40ad..580c2fa66de2 100644
--- a/core/java/com/android/internal/util/MemInfoReader.java
+++ b/core/java/com/android/internal/util/MemInfoReader.java
@@ -107,9 +107,12 @@ public final class MemInfoReader {
* Amount of RAM that is in use by the kernel for actual allocations.
*/
public long getKernelUsedSizeKb() {
- return mInfos[Debug.MEMINFO_SHMEM] + mInfos[Debug.MEMINFO_SLAB_UNRECLAIMABLE]
- + mInfos[Debug.MEMINFO_VM_ALLOC_USED] + mInfos[Debug.MEMINFO_PAGE_TABLES]
- + mInfos[Debug.MEMINFO_KERNEL_STACK];
+ long size = mInfos[Debug.MEMINFO_SHMEM] + mInfos[Debug.MEMINFO_SLAB_UNRECLAIMABLE]
+ + mInfos[Debug.MEMINFO_VM_ALLOC_USED] + mInfos[Debug.MEMINFO_PAGE_TABLES];
+ if (!Debug.isVmapStack()) {
+ size += mInfos[Debug.MEMINFO_KERNEL_STACK];
+ }
+ return size;
}
public long getSwapTotalSizeKb() {