[PATCH 2/2] dmabuf: Add dmabuf inode no to fdinfo

Kalesh Singh kaleshsingh at google.com
Thu Jan 28 19:21:07 UTC 2021


On Thu, Jan 28, 2021 at 1:55 PM Randy Dunlap <rdunlap at infradead.org> wrote:
>
> On 1/28/21 10:24 AM, Kalesh Singh wrote:
> > The dmabuf inode number allows userspace to uniquely identify the buffer
> > and avoids a dependency on /proc/<pid>/fd/* when accounting per-process
> > DMA buffer sizes.
> >
> > Signed-off-by: Kalesh Singh <kaleshsingh at google.com>
> > ---
> >  drivers/dma-buf/dma-buf.c | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c
> > index 9ad6397aaa97..d869099ede83 100644
> > --- a/drivers/dma-buf/dma-buf.c
> > +++ b/drivers/dma-buf/dma-buf.c
> > @@ -414,6 +414,7 @@ static void dma_buf_show_fdinfo(struct seq_file *m, struct file *file)
> >  {
> >       struct dma_buf *dmabuf = file->private_data;
> >
> > +     seq_printf(m, "dmabuf_inode_no:\t%lu\n", file_inode(file)->i_ino);
> >       seq_printf(m, "size:\t%zu\n", dmabuf->size);
> >       /* Don't count the temporary reference taken inside procfs seq_show */
> >       seq_printf(m, "count:\t%ld\n", file_count(dmabuf->file) - 1);
> >
>
> [resending; hopefully the first one didn't go anywhere]
>
>
> Hi,
>
> The subject is a little confusing.
> It seems to say that the dmabuf inode no is being added to /proc/<pid>/fdinfo,
> but looking at the code, it is being added to /proc/dmabuf (or /proc/<pid>/dmabuf).
>
> Please clarify.
>
> and is the /proc file format documented anywhere?

Hi Randy,

The patch adds the inode number in /proc/<pid>/fdinfo/* and
/proc/<pid>/task/<tid>/fdinfo/* for FDs corresponding to dmabufs.
fdinfo is documented in proc man pages, but it doesn't include the
dmabuf specific fields, so this will need to be updated. I hope this
clarifies.

Thanks,
Kalesh

>
>
> thanks.
>
> --
> ~Randy
>


More information about the dri-devel mailing list