ANDROID: Track per-process dmabuf PSS
DMA buffers exist for sharing memory, so dividing a buffer's size by the
number of processes with references to it to obtain proportional set
size is a useful metric for understanding an individual process's share
of system-wide dmabuf memory.
Dmabuf memory is not guaranteed to be representable by struct pages, and
a process may hold only file descriptor references to a buffer. So PSS
cannot be calculated on a per-page basis, and PSS accounting is always
performed in units of the full buffer size, and only once for each
process regardless of the number and type of references a process has
for a single buffer.
The /proc/<pid>/dmabuf_pss file in procfs now reports the sum of all
buffer PSS values referenced by a process. The units are bytes. This
allows userspace to obtain per-process dmabuf accounting information
quickly compared to calculating it from multiple sources in procfs and
sysfs.
Note that a dmabuf can be backed by different types of memory such as
system DRAM, GPU VRAM, or others. This patch makes no distinction
between these different types of memory, so on systems with non-unified
memory the reported values should be interpreted with this in mind.
Bug: 424648392
Change-Id: I3bcb10bf5004949051f5860003380669755b3358
Signed-off-by:
T.J. Mercier <tjmercier@google.com>
Loading