From patchwork Tue Jun 23 16:11:02 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 6662301 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 13E24C05AC for ; Tue, 23 Jun 2015 16:11:26 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CC3652064B for ; Tue, 23 Jun 2015 16:11:24 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id ECD752063F for ; Tue, 23 Jun 2015 16:11:23 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 474436E059; Tue, 23 Jun 2015 09:11:23 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from fireflyinternet.com (unknown [87.106.93.118]) by gabe.freedesktop.org (Postfix) with ESMTP id 5C0386E059 for ; Tue, 23 Jun 2015 09:11:21 -0700 (PDT) X-Default-Received-SPF: pass (skip=forwardok (res=PASS)) x-ip-name=78.156.65.138; Received: from nuc-i3427.alporthouse.com (unverified [78.156.65.138]) by fireflyinternet.com (Firefly Internet (M1)) with ESMTP id 41420998-1500048 for multiple; Tue, 23 Jun 2015 17:11:42 +0100 Received: by nuc-i3427.alporthouse.com (sSMTP sendmail emulation); Tue, 23 Jun 2015 17:11:02 +0100 Date: Tue, 23 Jun 2015 17:11:02 +0100 From: Chris Wilson To: Derek Morton , intel-gfx@lists.freedesktop.org, thomas.wood@intel.com Message-ID: <20150623161102.GP12403@nuc-i3427.alporthouse.com> Mail-Followup-To: Chris Wilson , Derek Morton , intel-gfx@lists.freedesktop.org, thomas.wood@intel.com References: <1435074352-19241-1-git-send-email-derek.j.morton@intel.com> <20150623155829.GN12403@nuc-i3427.alporthouse.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20150623155829.GN12403@nuc-i3427.alporthouse.com> User-Agent: Mutt/1.5.21 (2010-09-15) Subject: Re: [Intel-gfx] [PATCH i-g-t v2] tests/gem_fence_thrash.c: Reduce memory usage X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-5.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 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; }