[Intel-gfx] [PATCH i-g-t v2] tests/gem_fence_thrash.c: Reduce memory usage

Chris Wilson chris at chris-wilson.co.uk
Tue Jun 23 09:11:02 PDT 2015


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

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;
 }
 
Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the Intel-gfx mailing list