Re: [PATCH v2] dma-buf: Add DmaBufTotal counter in meminfo
From: Peter.Enderborg
Date: Tue Apr 20 2021 - 11:02:44 EST
On 4/20/21 4:48 PM, Daniel Stone wrote:
> On Tue, 20 Apr 2021 at 14:46, <Peter.Enderborg@xxxxxxxx <mailto:Peter.Enderborg@xxxxxxxx>> wrote:
>
> On 4/20/21 3:34 PM, Daniel Stone wrote:
> > On Fri, 16 Apr 2021 at 13:34, Peter Enderborg <peter.enderborg@xxxxxxxx <mailto:peter.enderborg@xxxxxxxx> <mailto:peter.enderborg@xxxxxxxx <mailto:peter.enderborg@xxxxxxxx>>> wrote:
> > This adds a total used dma-buf memory. Details
> > can be found in debugfs, however it is not for everyone
> > and not always available. dma-buf are indirect allocated by
> > userspace. So with this value we can monitor and detect
> > userspace applications that have problems.
> >
> >
> > FWIW, this won't work super well for Android where gralloc is implemented as a system service, so all graphics usage will instantly be accounted to it.
>
> This resource allocation is a big part of why we need it. Why should it not work?
>
>
> Sorry, I'd somehow completely misread that as being locally rather than globally accounted. Given that, it's more correct, just also not super useful.
>
> Some drivers export allocation tracepoints which you could use if you have a decent userspace tracing infrastructure. Short of that, many drivers export this kind of thing through debugfs already. I think a better long-term direction is probably getting accounting from dma-heaps rather than extending core dmabuf itself.
>
> Cheers,
> Daniel
Debugfs and traces are useful when you pin down your problem. Debugfs does not exist on commercial devices so we need some hints on what going on, and trace points needs active debugging
and before the problem occurs. A metric on dma-buf can be sent with a bugreport.