linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pekka Paalanen <ppaalanen@gmail.com>
To: <Peter.Enderborg@sony.com>
Cc: <linux-kernel@vger.kernel.org>, <linux-fsdevel@vger.kernel.org>,
	<sumit.semwal@linaro.org>, <christian.koenig@amd.com>,
	<adobriyan@gmail.com>, <akpm@linux-foundation.org>,
	<songmuchun@bytedance.com>, <guro@fb.com>, <shakeelb@google.com>,
	<mhocko@suse.com>, <neilb@suse.de>, <samitolvanen@google.com>,
	<rppt@kernel.org>, <linux-media@vger.kernel.org>,
	<dri-devel@lists.freedesktop.org>,
	<linaro-mm-sig@lists.linaro.org>, <willy@infradead.org>
Subject: Re: [PATCH v5] dma-buf: Add DmaBufTotal counter in meminfo
Date: Wed, 21 Apr 2021 16:05:46 +0300	[thread overview]
Message-ID: <20210421160546.7045245f@eldfell> (raw)
In-Reply-To: <cbde932e-8887-391f-4a1d-515e5c56c01d@sony.com>

[-- Attachment #1: Type: text/plain, Size: 2572 bytes --]

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

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  parent reply	other threads:[~2021-04-21 13:10 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-17 16:38 [PATCH v5] dma-buf: Add DmaBufTotal counter in meminfo Peter Enderborg
2021-04-20  8:58 ` Daniel Vetter
2021-04-20  9:26   ` Peter.Enderborg
2021-04-20  9:41     ` Mike Rapoport
2021-04-20 10:45       ` Peter.Enderborg
2021-04-20 11:52         ` Mike Rapoport
2021-04-20 12:03           ` Peter.Enderborg
2021-04-20 11:14     ` Daniel Vetter
2021-04-20 11:37       ` Peter.Enderborg
2021-04-21  9:15         ` Daniel Vetter
2021-04-21 10:37           ` Peter.Enderborg
2021-04-21 10:57             ` Michal Hocko
2021-04-21 13:05             ` Pekka Paalanen [this message]
2021-04-21 15:31             ` Mike Rapoport
2021-04-21 17:35               ` Peter.Enderborg
2021-04-22  8:06                 ` Mike Rapoport
2021-04-22 14:08                   ` Peter.Enderborg
2021-04-25  7:33                     ` Mike Rapoport
2021-04-25  8:40                       ` Peter.Enderborg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210421160546.7045245f@eldfell \
    --to=ppaalanen@gmail.com \
    --cc=Peter.Enderborg@sony.com \
    --cc=adobriyan@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=christian.koenig@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=guro@fb.com \
    --cc=linaro-mm-sig@lists.linaro.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mhocko@suse.com \
    --cc=neilb@suse.de \
    --cc=rppt@kernel.org \
    --cc=samitolvanen@google.com \
    --cc=shakeelb@google.com \
    --cc=songmuchun@bytedance.com \
    --cc=sumit.semwal@linaro.org \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).