Proposal to report GPU private memory allocations with sysfs nodes [plain text version]

Rohan Garg rohan.garg at collabora.com
Thu Dec 19 16:18:13 UTC 2019


Hey

> Is it reasonable to add another ioctl or something equivalent to label
> a BO with what PID makes the allocation? When the BO gets shared to
> other processes, this information also needs to be bookkept somewhere
> for tracking. Basically I wonder if it's possible for upstream to
> track BOs in a similar way Android tracks dmabuf. Then there's a node
> implemented by cgroup in proc listing all the BOs per process with
> information like label, refcount, etc. Then Android GPU vendors can
> implement the same nodes which is going to be compatible even if they
> later adopts drm subsystem.
> 
> So my sketch idea for the nodes are:
> (1) /proc/gpu0_meminfo, /proc/gpu1_meminfo
> This is a list of all BOs with pids holding a reference to it and the
> current label of each BO
> (2) /proc/<pid>/gpu0_meminfo, /proc/<pid>/gpu1_meminfo
> This is a list of all BOs this process holds a reference to.
> (3) Is it reasonable to implement another nodes for {total,
> total_unmapped} counters? or just surface through /proc/meminfo?
> 

This would be tricky to implement because:

(1) PID's are not unique, PID namespaces allow linux userspace to potentially 
share the same PID.

(2) Specifically in the case of mesa, there isn't a way to (AFAIK) associate a 
BO with a PID.

Cheers
Rohan Garg




More information about the dri-devel mailing list