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

Commit f0622a55 authored by shisiyuan's avatar shisiyuan Committed by Cherrypicker Worker
Browse files

add MEMINFO_SWAP_CACHED in 'cached kernel memory'



In LostRam equation, SwapCached is included in totalSwapPss,
and is subtracted with it. But SwapCached still occupies
memory and can be swapped out under system ram pressure.
So it makes sense to add it in cached kernel memory, and
this can make lostram calculation more accurate.

Test: dumpsys meminfo
Signed-off-by: default avatarshisiyuan <shisiyuan@lixiang.com>
(cherry picked from https://android-review.googlesource.com/q/commit:c51c79dc1a602216813a9d170475bb975589b856)
Merged-In: I564157331eafd23ab1581848735b75d87fa3c8d5
Change-Id: I564157331eafd23ab1581848735b75d87fa3c8d5
parent 05d4f9aa
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -2059,7 +2059,9 @@ public final class Debug
    /** @hide */
    public static final int MEMINFO_CMA_FREE = 25;
    /** @hide */
    public static final int MEMINFO_COUNT = 26;
    public static final int MEMINFO_SWAP_CACHED = 26;
    /** @hide */
    public static final int MEMINFO_COUNT = 27;

    /**
     * Retrieves /proc/meminfo.  outSizes is filled with fields
+2 −1
Original line number Diff line number Diff line
@@ -108,7 +108,8 @@ public final class MemInfoReader {
            kReclaimable = mInfos[Debug.MEMINFO_SLAB_RECLAIMABLE];
        }
        return mInfos[Debug.MEMINFO_BUFFERS] + kReclaimable
                + mInfos[Debug.MEMINFO_CACHED] - mInfos[Debug.MEMINFO_MAPPED];
                + mInfos[Debug.MEMINFO_CACHED] - mInfos[Debug.MEMINFO_MAPPED]
                + mInfos[Debug.MEMINFO_SWAP_CACHED];
    }

    /**
+1 −0
Original line number Diff line number Diff line
@@ -406,6 +406,7 @@ enum {
    MEMINFO_INACTIVE_FILE,
    MEMINFO_CMA_TOTAL,
    MEMINFO_CMA_FREE,
    MEMINFO_SWAP_CACHED,
    MEMINFO_COUNT
};