Mali: bifrost: log: Add pid and task_comm of contexts in the info read from node "gpu_memory"
The output of "cat /sys/kernel/debug/mali0/gpu_memory" would look like: <dev> <pages> mali0 13312 <kctx> <comm> <pid> <pages> kctx-0x0000000000000000 system_server 609 1653 kctx-0x0000000000000000 droid.launcher3 1042 1636 kctx-0x0000000000000000 ndroid.systemui 802 5859 kctx-0x0000000000000000 ndroid.settings 915 1566 kctx-0x0000000000000000 surfaceflinger 310 2590 Signed-off-by: Zhen Chen <chenzhen@rock-chips.com> Change-Id: Ifc8e4a49cc00aff54feacc1fbcdacf3af255e0a1
This commit is contained in:
@@ -48,18 +48,30 @@ 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, "<dev> <pages>\n");
|
||||
seq_printf(sfile, "%-16s %10u\n",
|
||||
kbdev->devname,
|
||||
atomic_read(&(kbdev->memdev.used_pages)));
|
||||
mutex_lock(&kbdev->kctx_list_lock);
|
||||
seq_printf(sfile, " <kctx> <comm> <pid> <pages>\n");
|
||||
list_for_each_entry(kctx, &kbdev->kctx_list, kctx_list_link) {
|
||||
struct pid *pid_struct;
|
||||
struct task_struct *task;
|
||||
|
||||
rcu_read_lock();
|
||||
pid_struct = find_get_pid(kctx->tgid);
|
||||
task = pid_task(pid_struct, PIDTYPE_PID);
|
||||
/* output the memory usage and cap for each kctx
|
||||
* opened on this device
|
||||
*/
|
||||
seq_printf(sfile, " %s-0x%pK %10u\n",
|
||||
seq_printf(sfile, " %s-0x%pK %-20s %-10d %10u\n",
|
||||
"kctx",
|
||||
kctx,
|
||||
task ? task->comm : "[null comm]",
|
||||
kctx->tgid,
|
||||
atomic_read(&(kctx->used_pages)));
|
||||
put_pid(pid_struct);
|
||||
rcu_read_unlock();
|
||||
}
|
||||
mutex_unlock(&kbdev->kctx_list_lock);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user