[i-g-t,v2] tests/gem_fence_thrash.c: Reduce memory usage
diff mbox

Message ID 20150623161102.GP12403@nuc-i3427.alporthouse.com
State New
Headers show

Commit Message

Chris Wilson June 23, 2015, 4:11 p.m. UTC
On Tue, Jun 23, 2015 at 04:58:29PM +0100, Chris Wilson wrote:
> On Tue, Jun 23, 2015 at 04:45:52PM +0100, Derek Morton wrote:
> > On android platforms with 1Gb RAM gem_fence_thrash was failing
> > with an out of memory error.
> > This patch causes gem_close() to be called when a handle is
> > no longer required rather than relying on the cleanup when
> > the fd is closed. This greatly improves the memory footprint
> > of the test allowing it to run on 1Mb systems.
> Urm. We allocate the surfaces from the test.fd, and we close(test.fd) at
> the end of every test. We munmap all the pointers (except bo_copy has a
> leak of the mmaps), so we should not have been leaking any bo between
> tests. This should not be improving the memory footprint at all, but
> suggests something is wrong in your kernel.

Spotted it, _bo_write_verify inflates the memory footprint by 1000%.
Ok, all's happy now!

You also want

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>

diff mbox

diff --git a/tests/gem_fence_thrash.c b/tests/gem_fence_thrash.c
index 6447e13..cada526 100644
--- a/tests/gem_fence_thrash.c
+++ b/tests/gem_fence_thrash.c
@@ -100,6 +100,9 @@  bo_copy (void *_arg)
                sched_yield ();
+       munmap(a, OBJECT_SIZE);
+       munmap(b, OBJECT_SIZE);
        return NULL;