* [PATCH] drm/amdgpu: fix amdgpu_ttm_bo_eviction_valuable
@ 2017-04-20 11:49 Christian König
[not found] ` <1492688977-1757-1-git-send-email-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: Christian König @ 2017-04-20 11:49 UTC (permalink / raw)
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
From: Christian König <christian.koenig@amd.com>
BOs not mapped into the GART are always valuable for an eviction. Otherwise we
don't correctly swap them out on VRAM evictions during memory pressure.
Signed-off-by: Christian König <christian.koenig@amd.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index e5d460e..ab7317e 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -1040,11 +1040,17 @@ uint64_t amdgpu_ttm_tt_pte_flags(struct amdgpu_device *adev, struct ttm_tt *ttm,
static bool amdgpu_ttm_bo_eviction_valuable(struct ttm_buffer_object *bo,
const struct ttm_place *place)
{
- if (bo->mem.mem_type == TTM_PL_VRAM &&
- bo->mem.start == AMDGPU_BO_INVALID_OFFSET) {
- unsigned long num_pages = bo->mem.num_pages;
- struct drm_mm_node *node = bo->mem.mm_node;
+ unsigned long num_pages = bo->mem.num_pages;
+ struct drm_mm_node *node = bo->mem.mm_node;
+ if (bo->mem.start != AMDGPU_BO_INVALID_OFFSET)
+ return ttm_bo_eviction_valuable(bo, place);
+
+ switch (bo->mem.mem_type) {
+ case TTM_PL_TT:
+ return true;
+
+ case TTM_PL_VRAM:
/* Check each drm MM node individually */
while (num_pages) {
if (place->fpfn < (node->start + node->size) &&
@@ -1054,8 +1060,10 @@ static bool amdgpu_ttm_bo_eviction_valuable(struct ttm_buffer_object *bo,
num_pages -= node->size;
++node;
}
+ break;
- return false;
+ default:
+ break;
}
return ttm_bo_eviction_valuable(bo, place);
--
2.5.0
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply related [flat|nested] 3+ messages in thread[parent not found: <1492688977-1757-1-git-send-email-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>]
* Re: [PATCH] drm/amdgpu: fix amdgpu_ttm_bo_eviction_valuable [not found] ` <1492688977-1757-1-git-send-email-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org> @ 2017-04-20 12:48 ` Alex Deucher [not found] ` <CADnq5_N2KHdP3vkiY4Cfg6dKEqk1kF8_17N6s9H_0E7yQNDciA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 0 siblings, 1 reply; 3+ messages in thread From: Alex Deucher @ 2017-04-20 12:48 UTC (permalink / raw) To: Christian König; +Cc: amd-gfx list On Thu, Apr 20, 2017 at 7:49 AM, Christian König <deathsimple@vodafone.de> wrote: > From: Christian König <christian.koenig@amd.com> > > BOs not mapped into the GART are always valuable for an eviction. Otherwise we > don't correctly swap them out on VRAM evictions during memory pressure. > > Signed-off-by: Christian König <christian.koenig@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> > --- > drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 18 +++++++++++++----- > 1 file changed, 13 insertions(+), 5 deletions(-) > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c > index e5d460e..ab7317e 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c > @@ -1040,11 +1040,17 @@ uint64_t amdgpu_ttm_tt_pte_flags(struct amdgpu_device *adev, struct ttm_tt *ttm, > static bool amdgpu_ttm_bo_eviction_valuable(struct ttm_buffer_object *bo, > const struct ttm_place *place) > { > - if (bo->mem.mem_type == TTM_PL_VRAM && > - bo->mem.start == AMDGPU_BO_INVALID_OFFSET) { > - unsigned long num_pages = bo->mem.num_pages; > - struct drm_mm_node *node = bo->mem.mm_node; > + unsigned long num_pages = bo->mem.num_pages; > + struct drm_mm_node *node = bo->mem.mm_node; > > + if (bo->mem.start != AMDGPU_BO_INVALID_OFFSET) > + return ttm_bo_eviction_valuable(bo, place); > + > + switch (bo->mem.mem_type) { > + case TTM_PL_TT: > + return true; > + > + case TTM_PL_VRAM: > /* Check each drm MM node individually */ > while (num_pages) { > if (place->fpfn < (node->start + node->size) && > @@ -1054,8 +1060,10 @@ static bool amdgpu_ttm_bo_eviction_valuable(struct ttm_buffer_object *bo, > num_pages -= node->size; > ++node; > } > + break; > > - return false; > + default: > + break; > } > > return ttm_bo_eviction_valuable(bo, place); > -- > 2.5.0 > > _______________________________________________ > amd-gfx mailing list > amd-gfx@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/amd-gfx _______________________________________________ amd-gfx mailing list amd-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/amd-gfx ^ permalink raw reply [flat|nested] 3+ messages in thread
[parent not found: <CADnq5_N2KHdP3vkiY4Cfg6dKEqk1kF8_17N6s9H_0E7yQNDciA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* Re: [PATCH] drm/amdgpu: fix amdgpu_ttm_bo_eviction_valuable [not found] ` <CADnq5_N2KHdP3vkiY4Cfg6dKEqk1kF8_17N6s9H_0E7yQNDciA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2017-04-21 8:37 ` zhoucm1 0 siblings, 0 replies; 3+ messages in thread From: zhoucm1 @ 2017-04-21 8:37 UTC (permalink / raw) To: Alex Deucher, Christian König; +Cc: amd-gfx list On 2017年04月20日 20:48, Alex Deucher wrote: > On Thu, Apr 20, 2017 at 7:49 AM, Christian König > <deathsimple@vodafone.de> wrote: >> From: Christian König <christian.koenig@amd.com> >> >> BOs not mapped into the GART are always valuable for an eviction. Otherwise we >> don't correctly swap them out on VRAM evictions during memory pressure. >> >> Signed-off-by: Christian König <christian.koenig@amd.com> > Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Although it doesn't fix my issue, it seems more reasonable compared previous, Reviewed-by: Chunming Zhou <david1.zhou@amd.com> > >> --- >> drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 18 +++++++++++++----- >> 1 file changed, 13 insertions(+), 5 deletions(-) >> >> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c >> index e5d460e..ab7317e 100644 >> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c >> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c >> @@ -1040,11 +1040,17 @@ uint64_t amdgpu_ttm_tt_pte_flags(struct amdgpu_device *adev, struct ttm_tt *ttm, >> static bool amdgpu_ttm_bo_eviction_valuable(struct ttm_buffer_object *bo, >> const struct ttm_place *place) >> { >> - if (bo->mem.mem_type == TTM_PL_VRAM && >> - bo->mem.start == AMDGPU_BO_INVALID_OFFSET) { >> - unsigned long num_pages = bo->mem.num_pages; >> - struct drm_mm_node *node = bo->mem.mm_node; >> + unsigned long num_pages = bo->mem.num_pages; >> + struct drm_mm_node *node = bo->mem.mm_node; >> >> + if (bo->mem.start != AMDGPU_BO_INVALID_OFFSET) >> + return ttm_bo_eviction_valuable(bo, place); >> + >> + switch (bo->mem.mem_type) { >> + case TTM_PL_TT: >> + return true; >> + >> + case TTM_PL_VRAM: >> /* Check each drm MM node individually */ >> while (num_pages) { >> if (place->fpfn < (node->start + node->size) && >> @@ -1054,8 +1060,10 @@ static bool amdgpu_ttm_bo_eviction_valuable(struct ttm_buffer_object *bo, >> num_pages -= node->size; >> ++node; >> } >> + break; >> >> - return false; >> + default: >> + break; >> } >> >> return ttm_bo_eviction_valuable(bo, place); >> -- >> 2.5.0 >> >> _______________________________________________ >> amd-gfx mailing list >> amd-gfx@lists.freedesktop.org >> https://lists.freedesktop.org/mailman/listinfo/amd-gfx > _______________________________________________ > amd-gfx mailing list > amd-gfx@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/amd-gfx _______________________________________________ amd-gfx mailing list amd-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/amd-gfx ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-04-21 8:37 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-20 11:49 [PATCH] drm/amdgpu: fix amdgpu_ttm_bo_eviction_valuable Christian König
[not found] ` <1492688977-1757-1-git-send-email-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2017-04-20 12:48 ` Alex Deucher
[not found] ` <CADnq5_N2KHdP3vkiY4Cfg6dKEqk1kF8_17N6s9H_0E7yQNDciA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-04-21 8:37 ` zhoucm1
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.