On Wed, Dec 09, 2020 at 08:43:57PM -0800, Hridya Valsaraju wrote: > This patch allows statistics to be enabled for each DMA-BUF in > sysfs by enabling the config CONFIG_DMABUF_SYSFS_STATS. > > The following stats will be exposed by the interface: > > /sys/kernel/dmabuf/<inode_number>/exporter_name > /sys/kernel/dmabuf/<inode_number>/size > /sys/kernel/dmabuf/<inode_number>/dev_map_info > > The inode_number is unique for each DMA-BUF and was added earlier [1] > in order to allow userspace to track DMA-BUF usage across different > processes. > > Currently, this information is exposed in > /sys/kernel/debug/dma_buf/bufinfo. > However, since debugfs is considered unsafe to be mounted in production, > it is being duplicated in sysfs. > > This information is intended to help with root-causing > low-memory kills and the debugging/analysis of other memory-related issues. > > It will also be used to derive DMA-BUF > per-exporter stats and per-device usage stats for Android Bug reports. > > [1]: https://lore.kernel.org/patchwork/patch/1088791/ > > Signed-off-by: Hridya Valsaraju <hridya@xxxxxxxxxx> Thanks for adding all of this, nice work! Reviewed-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>