On Wed, 21 Apr 2021 10:37:11 +0000 Peter.Enderborg@sony.com wrote:
On 4/21/21 11:15 AM, Daniel Vetter wrote:
On Tue, Apr 20, 2021 at 11:37:41AM +0000, Peter.Enderborg@sony.com wrote:
But I dont think they will. dma-buf does not have to be mapped to a process, and the case of vram, it is not covered in current global_zone. All of them would be very nice to have in some form. But it wont change what the correct value of what "Total" is.
We need to understand what the "correct" value is. Not in terms of kernel code, but in terms of semantics. Like if userspace allocates a GL texture, is this supposed to show up in your metric or not. Stuff like that.
That it like that would like to only one pointer type. You need to know what you pointing at to know what it is. it might be a hardware or a other pointer.
To clarify the GL texture example: a GL texture consumes "graphics memory", whatever that is, but they are not allocated as dmabufs. So they count for resource consumption, but they do not show up in your counter, until they become exported. Most GL textures are never exported at all. In fact, exporting GL textures is a path strongly recommended against due to unsuitable EGL/GL API.
As far as I understand, dmabufs are never allocated as is. Dmabufs always just wrap an existing memory allocation. So creating (exporting) a dmabuf does not increase resource usage. Allocation increases resource usage, and most allocations are never exported.
If there is a limitation on your pointers it is a good metric to count them even if you don't know what they are. Same goes for dma-buf, they are generic, but they consume some resources that are counted in pages.
Given above, I could even argue that *dmabufs* do not consume resources. They only reference resources that were already allocated by some specific means (not generic). They might keep the resource allocated, preventing it from being freed if leaked.
As you might know, there is no really generic "dmabuf allocator", not as a kernel UAPI nor as a userspace library (the hypothetical Unix Device Memory Allocator library notwithstanding).
So this kind of leaves the question, what is DmaBufTotal good for? Is it the same kind of counter as VIRT in 'top'? If you know your particular programs, you can maybe infer if VIRT is too much or not, but for e.g. WebKitWebProcess it is normal to have 85 GB in VIRT and it's not a problem (like I have, on this 8 GB RAM machine).
Thanks, pq
linaro-mm-sig@lists.linaro.org