All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yiwei Zhang <zzyiwei@google.com>
To: Pekka Paalanen <ppaalanen@gmail.com>, daniel@ffwll.ch
Cc: Alistair Delva <adelva@google.com>,
	Rohan Garg <rohan.garg@collabora.com>,
	Jerome Glisse <jglisse@redhat.com>,
	dri-devel <dri-devel@lists.freedesktop.org>,
	Prahlad Kilambi <prahladk@google.com>,
	Sean Paul <seanpaul@chromium.org>,
	kraxel@redhat.com, Kenny Ho <y2kenny@gmail.com>,
	Chris Forbes <chrisforbes@google.com>,
	kernel-team@android.com
Subject: Re: Proposal to report GPU private memory allocations with sysfs nodes [plain text version]
Date: Mon, 4 Nov 2019 11:34:33 -0800	[thread overview]
Message-ID: <CAKT=dDmLao+P-hHrc2fsQ-7yyViFm-QFKKOEZ4D2EFobvAJLhg@mail.gmail.com> (raw)
In-Reply-To: <20191101103657.2107c6e1@eldfell.localdomain>

Hi folks,

(Daniel, I just moved you to this thread)

Below are the latest thoughts based on all the feedback and comments.

First, I need to clarify on the gpu memory object type enumeration
thing. We don't want to enforce those enumerations across the upstream
and Android, and we should just leave those configurable and flexible.

Second, to make this effort also useful to all the other memory
management tools like PSS. At least an additional node is needed for
the part of the gpu private allocation not mapped to the
userspace(invisible to PSS). This is especially critical for the
downstream Android so that low-memory-killer(lmkd) can be aware of the
actual total memory for a process and will know how much gets freed up
if it kills that process. This is an effort to de-mystify the "lost
ram".

Given above, the new node structure would look like below:

Global nodes:
/sys/devices/<root>/gpu_mem/global/total /* Total private allocation
for coherency, this should also include the anonymous memory allocated
in the kmd  */
/sys/devices/<root>/gpu_mem/global/total_unmapped /* Account for the
private allocation not mapped to userspace(not visible for PSS), don't
need to be coherent with the "total" node. lmkd or equivalent service
looking at PSS will only look at this node in addition. */
/sys/devices/<root>/gpu_mem/global/<type1> /* One total value per
type, this should also include the anonymous memory allocated in the
kmd(or maybe another anonymous type for global nodes)  */
/sys/devices/<root>/gpu_mem/global/<type2> /* One total value per type */
...
/sys/devices/<root>/gpu_mem/global/<typeN> /* One total value per type */

Per process nodes:
/sys/devices/<root>/gpu_mem/proc/<pid>/total /* Total private
allocation for coherency */
/sys/devices/<root>/gpu_mem/proc/<pid>/total_unmapped /* Account for
the private allocation not mapped to userspace(not visible for PSS),
don't need to be coherent with the "total" node. lmkd or equivalent
service looking at PSS will only look at this node in addition. */
/sys/devices/<root>/gpu_mem/proc/<pid>/<type1> /* One total value per type */
/sys/devices/<root>/gpu_mem/proc/<pid>/<type2> /* One total value per type */
...
/sys/devices/<root>/gpu_mem/proc/<pid>/<typeN> /* One total value per type */

The type1 to typeN for downstream Android will be the enumerations I
mentioned in the original email which are: unknown, shader,...,
transient. For the upstream, those can be the labeled BOs or any other
customized types.

Look forward to the comments and feedback!

Best regards,
Yiwei




On Fri, Nov 1, 2019 at 1:37 AM Pekka Paalanen <ppaalanen@gmail.com> wrote:
>
> On Thu, 31 Oct 2019 13:57:00 -0400
> Kenny Ho <y2kenny@gmail.com> wrote:
>
> > Hi Yiwei,
> >
> > This is the latest series:
> > https://patchwork.kernel.org/cover/11120371/
> >
> > (I still need to reply some of the feedback.)
> >
> > Regards,
> > Kenny
> >
> > On Thu, Oct 31, 2019 at 12:59 PM Yiwei Zhang <zzyiwei@google.com> wrote:
> > >
> > > Hi Kenny,
> > >
> > > Thanks for the info. Do you mind forwarding the existing discussion to me or have me cc'ed in that thread?
> > >
> > > Best,
> > > Yiwei
> > >
> > > On Wed, Oct 30, 2019 at 10:23 PM Kenny Ho <y2kenny@gmail.com> wrote:
> > >>
> > >> Hi Yiwei,
> > >>
> > >> I am not sure if you are aware, there is an ongoing RFC on adding drm
> > >> support in cgroup for the purpose of resource tracking.  One of the
> > >> resource is GPU memory.  It's not exactly the same as what you are
> > >> proposing (it doesn't track API usage, but it tracks the type of GPU
> > >> memory from kmd perspective) but perhaps it would be of interest to
> > >> you.  There are no consensus on it at this point.
>
> Hi Yiwei,
>
> I'd like to point out an effort to have drivers label BOs for debugging
> purposes: https://lists.freedesktop.org/archives/dri-devel/2019-October/239727.html
>
> I don't know if it would work, but an obvious idea might be to use
> those labels for tracking the kinds of buffers - a piece of UAPI which I
> believe you are still missing.
>
>
> Thanks,
> pq
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2019-11-04 19:34 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-25 18:35 Proposal to report GPU private memory allocations with sysfs nodes [plain text version] Yiwei Zhang
2019-10-28 15:26 ` Jerome Glisse
2019-10-28 18:33   ` Yiwei Zhang
2019-10-29  1:19     ` Yiwei Zhang
2019-10-31  5:23       ` Kenny Ho
2019-10-31 16:59         ` Yiwei Zhang
2019-10-31 17:57           ` Kenny Ho
2019-11-01  8:36             ` Pekka Paalanen
2019-11-04 19:34               ` Yiwei Zhang [this message]
2019-11-05  9:47                 ` Daniel Vetter
2019-11-05 19:45                   ` Yiwei Zhang
2019-11-06  9:56                     ` Daniel Vetter
2019-11-06 16:55                   ` Rob Clark
2019-11-06 19:21                     ` Yiwei Zhang
2019-11-12 18:17                       ` Yiwei Zhang
2019-11-12 20:18                         ` Jerome Glisse
2019-11-15  1:02                           ` Yiwei Zhang
2019-12-13 22:09                             ` Yiwei Zhang
2019-12-19 16:18                             ` Rohan Garg
2019-12-19 18:52                               ` Yiwei Zhang
2020-01-06 10:46                                 ` Rohan Garg
2020-01-06 20:47                                   ` Yiwei Zhang
2020-03-20 12:07                                     ` Rohan Garg
2020-03-20 21:35                                       ` Yiwei Zhang
2019-10-29  8:33     ` Pekka Paalanen
2019-10-30 21:03       ` Yiwei Zhang
2019-10-30 22:06         ` Yiwei Zhang

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='CAKT=dDmLao+P-hHrc2fsQ-7yyViFm-QFKKOEZ4D2EFobvAJLhg@mail.gmail.com' \
    --to=zzyiwei@google.com \
    --cc=adelva@google.com \
    --cc=chrisforbes@google.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jglisse@redhat.com \
    --cc=kernel-team@android.com \
    --cc=kraxel@redhat.com \
    --cc=ppaalanen@gmail.com \
    --cc=prahladk@google.com \
    --cc=rohan.garg@collabora.com \
    --cc=seanpaul@chromium.org \
    --cc=y2kenny@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.