Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dccb2e3d authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Avoid subtracting shmem twice when calculating LOST RAM." into main am:...

Merge "Avoid subtracting shmem twice when calculating LOST RAM." into main am: 378aaa05 am: 6a162163

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/3292441



Change-Id: I5561ce1f25b523e27afdfa59def30f2c40e87ba7
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 4b497a09 6a162163
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -87,6 +87,13 @@ public final class MemInfoReader {
        return mInfos[Debug.MEMINFO_FREE];
    }

    /**
     * Amount of RAM that used by shared memory (shmem) and tmpfs
     */
    public long getShmemSizeKb() {
        return mInfos[Debug.MEMINFO_SHMEM];
    }

    /**
     * Amount of RAM that the kernel is being used for caches, not counting caches
     * that are mapped in to processes.
+4 −0
Original line number Diff line number Diff line
@@ -12824,6 +12824,8 @@ public class ActivityManagerService extends IActivityManager.Stub
            final long lostRAM = memInfo.getTotalSizeKb()
                    - (ss[INDEX_TOTAL_PSS] - ss[INDEX_TOTAL_SWAP_PSS])
                    - memInfo.getFreeSizeKb() - memInfo.getCachedSizeKb()
                    // NR_SHMEM is subtracted twice (getCachedSizeKb() and getKernelUsedSizeKb())
                    + memInfo.getShmemSizeKb()
                    - kernelUsed - memInfo.getZramTotalSizeKb();
            if (!opts.isCompact) {
                pw.print(" Used RAM: "); pw.print(stringifyKBSize(ss[INDEX_TOTAL_PSS] - cachedPss
@@ -13337,6 +13339,8 @@ public class ActivityManagerService extends IActivityManager.Stub
            long lostRAM = memInfo.getTotalSizeKb()
                    - (ss[INDEX_TOTAL_PSS] - ss[INDEX_TOTAL_SWAP_PSS])
                    - memInfo.getFreeSizeKb() - memInfo.getCachedSizeKb()
                    // NR_SHMEM is subtracted twice (getCachedSizeKb() and getKernelUsedSizeKb())
                    + memInfo.getShmemSizeKb()
                    - memInfo.getKernelUsedSizeKb() - memInfo.getZramTotalSizeKb();
            proto.write(MemInfoDumpProto.USED_PSS_KB, ss[INDEX_TOTAL_PSS] - cachedPss);
            proto.write(MemInfoDumpProto.USED_KERNEL_KB, memInfo.getKernelUsedSizeKb());