ANDROID: dmabuf: Add mmap_count to struct dmabuf

mmap_count can be used to  efficiently calculate the
PSS for any DMA buffer that the process has mapped.

Bug: 167141117
Change-Id: I8296981f0135a5532969aca3a8baa5da61dfe39f
Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
This commit is contained in:
Kalesh Singh
2021-01-08 12:10:08 -08:00
parent 7493fb28b3
commit 9132fbe545
4 changed files with 72 additions and 1 deletions

View File

@@ -381,6 +381,9 @@ struct dma_buf_ops {
* @sysfs_entry: for exposing information about this buffer in sysfs.
* The attachment_uid member of @sysfs_entry is protected by dma_resv lock
* and is incremented on each attach.
* @mmap_count: number of times buffer has been mmapped.
* @exp_vm_ops: the vm ops provided by the buffer exporter.
* @vm_ops: the overridden vm_ops used to track mmap_count of the buffer.
*
* This represents a shared buffer, created by calling dma_buf_export(). The
* userspace representation is a normal file descriptor, which can be created by
@@ -424,6 +427,9 @@ struct dma_buf {
unsigned int attachment_uid;
struct kset *attach_stats_kset;
} *sysfs_entry;
int mmap_count;
const struct vm_operations_struct *exp_vm_ops;
struct vm_operations_struct vm_ops;
#endif
};