All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Christian König" <ckoenig.leichtzumerken@gmail.com>
To: "Marek Olšák" <maraeo@gmail.com>
Cc: amd-gfx mailing list <amd-gfx@lists.freedesktop.org>
Subject: Re: [PATCH 1/3] drm/amdgpu: add AMDGPU_GEM_CREATE_DISCARDABLE
Date: Thu, 12 May 2022 09:25:58 +0200	[thread overview]
Message-ID: <11d9492c-f727-f149-d473-9cda4bab2760@gmail.com> (raw)
In-Reply-To: <CAAxE2A6wiL5fnegVo+tMsHBNb+HC3Nw=cmR4MdNVqLpEQYH1ug@mail.gmail.com>

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

Am 12.05.22 um 00:06 schrieb Marek Olšák:
> 3rd question: Is it worth using this on APUs?

It makes memory management somewhat easier when we are really OOM.

E.g. it should also work for GTT allocations and when the core kernel 
says "Hey please free something up or I will start the OOM-killer" it's 
something we can easily throw away.

Not sure how many of those buffers we have, but marking everything which 
is temporary with that flag is probably a good idea.

>
> Thanks,
> Marek
>
> On Wed, May 11, 2022 at 5:58 PM Marek Olšák <maraeo@gmail.com> wrote:
>
>     Will the kernel keep all discardable buffers in VRAM if VRAM is
>     not overcommitted by discardable buffers, or will other buffers
>     also affect the placement of discardable buffers?
>

Regarding the eviction pressure the buffers will be handled like any 
other buffer, but instead of preserving the content it is just discarded 
on eviction.

>
>     Do evictions deallocate the buffer, or do they keep an allocation
>     in GTT and only the copy is skipped?
>

It really deallocates the backing store of the buffer, just keeps a 
dummy page array around where all entries are NULL.

There is a patch set on the mailing list to make this a little bit more 
efficient, but even using the dummy page array should only have a few 
bytes overhead.

Regards,
Christian.

>
>     Thanks,
>     Marek
>
>     On Wed, May 11, 2022 at 3:08 AM Marek Olšák <maraeo@gmail.com> wrote:
>
>         OK that sounds good.
>
>         Marek
>
>         On Wed, May 11, 2022 at 2:04 AM Christian König
>         <ckoenig.leichtzumerken@gmail.com> wrote:
>
>             Hi Marek,
>
>             Am 10.05.22 um 22:43 schrieb Marek Olšák:
>>             A better flag name would be:
>>             AMDGPU_GEM_CREATE_BEST_PLACEMENT_OR_DISCARD
>
>             A bit long for my taste and I think the best placement is
>             just a side effect.
>
>>
>>             Marek
>>
>>             On Tue, May 10, 2022 at 4:13 PM Marek Olšák
>>             <maraeo@gmail.com> wrote:
>>
>>                 Does this really guarantee VRAM placement? The code
>>                 doesn't say anything about that.
>>
>
>             Yes, see the code here:
>
>>
>>                     diff --git
>>                     a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
>>                     b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
>>                     index 8b7ee1142d9a..1944ef37a61e 100644
>>                     --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
>>                     +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
>>                     @@ -567,6 +567,7 @@ int amdgpu_bo_create(struct
>>                     amdgpu_device *adev,
>>                                     bp->domain;
>>                             bo->allowed_domains = bo->preferred_domains;
>>                             if (bp->type != ttm_bo_type_kernel &&
>>                     +           !(bp->flags &
>>                     AMDGPU_GEM_CREATE_DISCARDABLE) &&
>>                                 bo->allowed_domains ==
>>                     AMDGPU_GEM_DOMAIN_VRAM)
>>                                     bo->allowed_domains |=
>>                     AMDGPU_GEM_DOMAIN_GTT;
>>
>
>             The only case where this could be circumvented is when you
>             try to allocate more than physically available on an APU.
>
>             E.g. you only have something like 32 MiB VRAM and request
>             64 MiB, then the GEM code will catch the error and
>             fallback to GTT (IIRC).
>
>             Regards,
>             Christian.
>

[-- Attachment #2: Type: text/html, Size: 9761 bytes --]

  reply	other threads:[~2022-05-12  7:26 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-06 11:23 [PATCH 1/3] drm/amdgpu: add AMDGPU_GEM_CREATE_DISCARDABLE Christian König
2022-05-06 11:23 ` [PATCH 2/3] drm/amdgpu: add AMDGPU_VM_NOALLOC Christian König
2022-05-10 21:21   ` Marek Olšák
2022-05-11  6:06     ` Christian König
2022-05-11  6:15       ` Lazar, Lijo
2022-05-11  7:22         ` Marek Olšák
2022-05-11  7:43           ` Christian König
2022-05-11 18:55             ` Marek Olšák
2022-05-16 11:06               ` Marek Olšák
2022-05-16 11:10                 ` Marek Olšák
2022-05-16 11:53                   ` Christian König
2022-05-16 12:56                     ` Marek Olšák
2022-05-16 16:13                       ` Christian König
2022-05-17  0:12                         ` Marek Olšák
2022-05-17  6:33                           ` Christian König
2022-05-18  8:28                             ` Christian König
2022-05-06 11:23 ` [PATCH 3/3] drm/amdgpu: bump minor version number Christian König
2022-05-06 13:34   ` Alex Deucher
2022-05-12  2:38     ` Marek Olšák
2022-05-06 15:04 ` [PATCH 1/3] drm/amdgpu: add AMDGPU_GEM_CREATE_DISCARDABLE Felix Kuehling
2022-05-10 20:13 ` Marek Olšák
2022-05-10 20:43   ` Marek Olšák
2022-05-11  6:04     ` Christian König
2022-05-11  7:08       ` Marek Olšák
2022-05-11 21:58         ` Marek Olšák
2022-05-11 22:06           ` Marek Olšák
2022-05-12  7:25             ` Christian König [this message]
2022-05-12 22:17               ` Marek Olšák
2022-05-13 11:24                 ` Christian König
     [not found]                 ` <62165c7c-892a-5b35-79dd-b90414ccb5cd@damsy.net>
2022-05-13 11:26                   ` Christian König
2022-07-08 14:58                     ` Marek Olšák
2022-07-11 10:15                       ` Christian König

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=11d9492c-f727-f149-d473-9cda4bab2760@gmail.com \
    --to=ckoenig.leichtzumerken@gmail.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=maraeo@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.