Re: [Intel-gfx] [PATCH] drm/i915: Remove leftover vma->obj->pages_pin_count on insert/remove

2019-10-15 Thread Matthew Auld

On 15/10/2019 11:01, Chris Wilson wrote:

We now do the page pin count upfront in vma_get_pages/vma_put_pages, so
that we do the allocations before we enter the vm->mutex. Then our vma
page references are tracking in vma->pages_count and the extra
obj->pages_pin_count being performed in i915_vma_insert/i915_vma_remove
is redundant, and worse throws off the shrinker's logic on when it can
free an object by unbinding it.

Could you also add Reported-by: Daniele Ceraolo Spurio 




Reported-by: Matthew Auld 
Signed-off-by: Chris Wilson 
Cc: Matthew Auld 

Reviewed-by: Matthew Auld 
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

[Intel-gfx] [PATCH] drm/i915: Remove leftover vma->obj->pages_pin_count on insert/remove

2019-10-15 Thread Chris Wilson
We now do the page pin count upfront in vma_get_pages/vma_put_pages, so
that we do the allocations before we enter the vm->mutex. Then our vma
page references are tracking in vma->pages_count and the extra
obj->pages_pin_count being performed in i915_vma_insert/i915_vma_remove
is redundant, and worse throws off the shrinker's logic on when it can
free an object by unbinding it.

Reported-by: Matthew Auld 
Signed-off-by: Chris Wilson 
Cc: Matthew Auld 
---
 drivers/gpu/drm/i915/i915_vma.c | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_vma.c b/drivers/gpu/drm/i915/i915_vma.c
index 7d936254bde7..e90c4d0af8fd 100644
--- a/drivers/gpu/drm/i915/i915_vma.c
+++ b/drivers/gpu/drm/i915/i915_vma.c
@@ -703,7 +703,6 @@ i915_vma_insert(struct i915_vma *vma, u64 size, u64 
alignment, u64 flags)
list_add_tail(>vm_link, >vm->bound_list);
 
if (vma->obj) {
-   atomic_inc(>obj->mm.pages_pin_count);
atomic_inc(>obj->bind_count);
assert_bind_count(vma->obj);
}
@@ -726,14 +725,12 @@ i915_vma_remove(struct i915_vma *vma)
if (vma->obj) {
struct drm_i915_gem_object *obj = vma->obj;
 
-   atomic_dec(>bind_count);
-
/*
 * And finally now the object is completely decoupled from this
 * vma, we can drop its hold on the backing storage and allow
 * it to be reaped by the shrinker.
 */
-   i915_gem_object_unpin_pages(obj);
+   atomic_dec(>bind_count);
assert_bind_count(obj);
}
 
-- 
2.23.0

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx