From 3b66c30b9185507a2866de5bdc8b216c025b8c60 Mon Sep 17 00:00:00 2001 From: binqi zhang Date: Wed, 20 Nov 2019 18:24:34 +0800 Subject: [PATCH] memtrack: fix wrong GL mem counting on AndroidP [2/3] PD#SWPL-16844 Problem: Lost ram caused by ion_page_pool_alloc Solution: count ion cached memory in other mtrack Verify: adb shell dumpsys meminfo Confirm EGL entries Change-Id: Ie9e5535089260ffb89568ec66774af25a3f694ec Signed-off-by: binqi zhang --- .../gpu/arm/midgard/mali_kbase_gpu_memory_debugfs.c | 11 ++++++++--- .../gpu/arm/midgard/mali_kbase_gpu_memory_debugfs.c | 12 +++++++++--- 2 files changed, 17 insertions(+), 6 deletions(-) mode change 100755 => 100644 bifrost/r16p0/kernel/drivers/gpu/arm/midgard/mali_kbase_gpu_memory_debugfs.c diff --git a/bifrost/r16p0/kernel/drivers/gpu/arm/midgard/mali_kbase_gpu_memory_debugfs.c b/bifrost/r16p0/kernel/drivers/gpu/arm/midgard/mali_kbase_gpu_memory_debugfs.c old mode 100755 new mode 100644 index 514b065..d96f286 --- a/bifrost/r16p0/kernel/drivers/gpu/arm/midgard/mali_kbase_gpu_memory_debugfs.c +++ b/bifrost/r16p0/kernel/drivers/gpu/arm/midgard/mali_kbase_gpu_memory_debugfs.c @@ -47,16 +47,21 @@ static int kbasep_gpu_memory_seq_show(struct seq_file *sfile, void *data) kbdev = list_entry(entry, struct kbase_device, entry); /* output the total memory usage and cap for this device */ - seq_printf(sfile, "%-16s %10u\n", + seq_printf(sfile, "%-16s %-16s %10u\n", kbdev->devname, + "total used_pages", atomic_read(&(kbdev->memdev.used_pages))); + seq_puts(sfile, "----------------------------------------------------\n"); + seq_printf(sfile, "%-16s %-16s %-16s\n", + "kctx", "pid", "used_pages"); + seq_puts(sfile, "----------------------------------------------------\n"); mutex_lock(&kbdev->kctx_list_lock); list_for_each_entry(element, &kbdev->kctx_list, link) { /* output the memory usage and cap for each kctx * opened on this device */ - seq_printf(sfile, " %s-0x%p %10u\n", - "kctx", + seq_printf(sfile, "%p %10u %10u\n", element->kctx, + element->kctx->tgid, atomic_read(&(element->kctx->used_pages))); } mutex_unlock(&kbdev->kctx_list_lock); diff --git a/dvalin/kernel/drivers/gpu/arm/midgard/mali_kbase_gpu_memory_debugfs.c b/dvalin/kernel/drivers/gpu/arm/midgard/mali_kbase_gpu_memory_debugfs.c index 2c42f5c..70fdbf1 100644 --- a/dvalin/kernel/drivers/gpu/arm/midgard/mali_kbase_gpu_memory_debugfs.c +++ b/dvalin/kernel/drivers/gpu/arm/midgard/mali_kbase_gpu_memory_debugfs.c @@ -47,20 +47,26 @@ static int kbasep_gpu_memory_seq_show(struct seq_file *sfile, void *data) kbdev = list_entry(entry, struct kbase_device, entry); /* output the total memory usage and cap for this device */ - seq_printf(sfile, "%-16s %10u\n", + seq_printf(sfile, "%-16s %-16s %10u\n", kbdev->devname, + "total used_pages", atomic_read(&(kbdev->memdev.used_pages))); + seq_puts(sfile, "----------------------------------------------------\n"); + seq_printf(sfile, "%-16s %-16s %-16s\n", + "kctx", "pid", "used_pages"); + seq_puts(sfile, "----------------------------------------------------\n"); mutex_lock(&kbdev->kctx_list_lock); list_for_each_entry(kctx, &kbdev->kctx_list, kctx_list_link) { /* output the memory usage and cap for each kctx * opened on this device */ - seq_printf(sfile, " %s-0x%p %10u\n", - "kctx", + seq_printf(sfile, "%p %10u %10u\n", kctx, + kctx->tgid, atomic_read(&(kctx->used_pages))); } mutex_unlock(&kbdev->kctx_list_lock); } + kbase_dev_list_put(kbdev_list); return 0; } -- 2.20.1