diff mbox

drm/i915/selftests: Free the backing store between iterations

Message ID 20180717082334.18774-1-chris@chris-wilson.co.uk (mailing list archive)
State New, archived
Headers show

Commit Message

Chris Wilson July 17, 2018, 8:23 a.m. UTC
In the huge pages tests, we may have lots of objects being trapped on
the freelist as we hold the struct_mutex allowing the free worker no
opportunity to recover the backing store. We also have stricter
requirements and the desire for large contiguous pages, further
increasing the allocation pressure. To reduce the chance of running out
of memory, we could either drop the mutex and flush the free worker, or
we could release the backing store directly. We do the latter in this
patch for simplicity.

References: https://bugs.freedesktop.org/show_bug.cgi?id=107254
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Matthew Auld <matthew.william.auld@gmail.com>
---
 drivers/gpu/drm/i915/selftests/huge_pages.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Matthew Auld July 17, 2018, 8:29 a.m. UTC | #1
On 17 July 2018 at 09:23, Chris Wilson <chris@chris-wilson.co.uk> wrote:
> In the huge pages tests, we may have lots of objects being trapped on
> the freelist as we hold the struct_mutex allowing the free worker no
> opportunity to recover the backing store. We also have stricter
> requirements and the desire for large contiguous pages, further
> increasing the allocation pressure. To reduce the chance of running out
> of memory, we could either drop the mutex and flush the free worker, or
> we could release the backing store directly. We do the latter in this
> patch for simplicity.
>
> References: https://bugs.freedesktop.org/show_bug.cgi?id=107254
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Matthew Auld <matthew.william.auld@gmail.com>
Reviewed-by: Matthew Auld <matthew.william.auld@gmail.com>
Chris Wilson July 17, 2018, 9:31 a.m. UTC | #2
Quoting Matthew Auld (2018-07-17 09:29:00)
> On 17 July 2018 at 09:23, Chris Wilson <chris@chris-wilson.co.uk> wrote:
> > In the huge pages tests, we may have lots of objects being trapped on
> > the freelist as we hold the struct_mutex allowing the free worker no
> > opportunity to recover the backing store. We also have stricter
> > requirements and the desire for large contiguous pages, further
> > increasing the allocation pressure. To reduce the chance of running out
> > of memory, we could either drop the mutex and flush the free worker, or
> > we could release the backing store directly. We do the latter in this
> > patch for simplicity.
> >
> > References: https://bugs.freedesktop.org/show_bug.cgi?id=107254
> > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> > Cc: Matthew Auld <matthew.william.auld@gmail.com>
> Reviewed-by: Matthew Auld <matthew.william.auld@gmail.com>

Thanks, and applied in the hope that the bug never reoccurs. There is
still a chance that the system doesn't have any large pages to give us,
even before the test runs.
-Chris
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/selftests/huge_pages.c b/drivers/gpu/drm/i915/selftests/huge_pages.c
index d9f439f6219f..7efb326badcd 100644
--- a/drivers/gpu/drm/i915/selftests/huge_pages.c
+++ b/drivers/gpu/drm/i915/selftests/huge_pages.c
@@ -570,6 +570,7 @@  static int igt_mock_ppgtt_misaligned_dma(void *arg)
 		i915_vma_close(vma);
 
 		i915_gem_object_unpin_pages(obj);
+		__i915_gem_object_put_pages(obj, I915_MM_NORMAL);
 		i915_gem_object_put(obj);
 	}
 
@@ -597,6 +598,7 @@  static void close_object_list(struct list_head *objects,
 
 		list_del(&obj->st_link);
 		i915_gem_object_unpin_pages(obj);
+		__i915_gem_object_put_pages(obj, I915_MM_NORMAL);
 		i915_gem_object_put(obj);
 	}
 }
@@ -866,6 +868,7 @@  static int igt_mock_ppgtt_64K(void *arg)
 			i915_vma_close(vma);
 
 			i915_gem_object_unpin_pages(obj);
+			__i915_gem_object_put_pages(obj, I915_MM_NORMAL);
 			i915_gem_object_put(obj);
 		}
 	}
@@ -1265,6 +1268,7 @@  static int igt_ppgtt_exhaust_huge(void *arg)
 			}
 
 			i915_gem_object_unpin_pages(obj);
+			__i915_gem_object_put_pages(obj, I915_MM_NORMAL);
 			i915_gem_object_put(obj);
 		}
 	}
@@ -1326,6 +1330,7 @@  static int igt_ppgtt_internal_huge(void *arg)
 		}
 
 		i915_gem_object_unpin_pages(obj);
+		__i915_gem_object_put_pages(obj, I915_MM_NORMAL);
 		i915_gem_object_put(obj);
 	}
 
@@ -1394,6 +1399,7 @@  static int igt_ppgtt_gemfs_huge(void *arg)
 		}
 
 		i915_gem_object_unpin_pages(obj);
+		__i915_gem_object_put_pages(obj, I915_MM_NORMAL);
 		i915_gem_object_put(obj);
 	}