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

Commit f85d1418 authored by Suren Baghdasaryan's avatar Suren Baghdasaryan
Browse files

Fix Lost RAM calculation by accounting for ION mapped heaps



ION mapped heaps are not reflected in process PSS because ION driver
maps them using remap_pfn_range that sets VM_PFNMAP flag for each
mapped ION heap VMA and consequently excludes these VMAs from PSS
calculation. Change memory accounting to consider ION mapped heaps
as part of kernel used memory which fixes the Lost RAM calculation
that currently includes mapped ION heaps.

Bug: 155409819
Test: verify Lost RAM after opening camera app
Signed-off-by: default avatarSuren Baghdasaryan <surenb@google.com>
Merged-In: I2bad40bbe7d14b1c61534d661b612200ef1084e4
Change-Id: I2bad40bbe7d14b1c61534d661b612200ef1084e4
parent 0941dd3d
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -12857,7 +12857,9 @@ public class ActivityManagerService extends IActivityManager.Stub
                        pw.print(" unmapped + ");
                        pw.print(stringifyKBSize(ionPool));
                        pw.println(" pools)");
                kernelUsed += ionUnmapped;
                // Note: mapped ION memory is not accounted in PSS due to VM_PFNMAP flag being
                // set on ION VMAs, therefore consider the entire ION heap as used kernel memory
                kernelUsed += ionHeap;
            }
            final long lostRAM = memInfo.getTotalSizeKb() - (totalPss - totalSwapPss)
                    - memInfo.getFreeSizeKb() - memInfo.getCachedSizeKb()
@@ -13594,7 +13596,9 @@ public class ActivityManagerService extends IActivityManager.Stub
            memInfoBuilder.append("       ION: ");
            memInfoBuilder.append(stringifyKBSize(ionHeap + ionPool));
            memInfoBuilder.append("\n");
            kernelUsed += ionUnmapped;
            // Note: mapped ION memory is not accounted in PSS due to VM_PFNMAP flag being
            // set on ION VMAs, therefore consider the entire ION heap as used kernel memory
            kernelUsed += ionHeap;
        }
        memInfoBuilder.append("  Used RAM: ");
        memInfoBuilder.append(stringifyKBSize(