From patchwork Tue Aug 14 13:10:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 10565613 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CFEE21390 for ; Tue, 14 Aug 2018 13:10:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C136E29C4E for ; Tue, 14 Aug 2018 13:10:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B24DB29C89; Tue, 14 Aug 2018 13:10:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 24AFF29C8D for ; Tue, 14 Aug 2018 13:10:52 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 87B1E6E1AD; Tue, 14 Aug 2018 13:10:51 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from fireflyinternet.com (mail.fireflyinternet.com [109.228.58.192]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8AEEB89DA2; Tue, 14 Aug 2018 13:10:49 +0000 (UTC) X-Default-Received-SPF: pass (skip=forwardok (res=PASS)) x-ip-name=78.156.65.138; Received: from haswell.alporthouse.com (unverified [78.156.65.138]) by fireflyinternet.com (Firefly Internet (M1)) with ESMTP id 12900069-1500050 for multiple; Tue, 14 Aug 2018 14:10:39 +0100 From: Chris Wilson To: igt-dev@lists.freedesktop.org Date: Tue, 14 Aug 2018 14:10:36 +0100 Message-Id: <20180814131036.9447-1-chris@chris-wilson.co.uk> X-Mailer: git-send-email 2.18.0 Subject: [Intel-gfx] [PATCH i-g-t] lib: Keep upto half of RAM reserved for test runner X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tomi Sarvela , intel-gfx@lists.freedesktop.org MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP Halve our estimated available RAM for use by the tests to avoid nasty situations where the test runner may force us into swap. Rumour has it that the new runner isn't quite so bloated as piglit... Signed-off-by: Chris Wilson Cc: Tomi Sarvela Cc: Petri Latvala --- lib/intel_os.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/intel_os.c b/lib/intel_os.c index 29a27272e..4037440fd 100644 --- a/lib/intel_os.c +++ b/lib/intel_os.c @@ -329,8 +329,11 @@ int __intel_check_memory(uint64_t count, uint64_t size, unsigned mode, mode & CHECK_SWAP ? " + swap": ""); total = 0; - if (mode & (CHECK_RAM | CHECK_SWAP)) - total += intel_get_avail_ram_mb(); + if (mode & (CHECK_RAM | CHECK_SWAP)) { + total = intel_get_avail_ram_mb(); + /* Keep some in reserve for the runner. */ + total -= min(total / 2, 1000); + } if (mode & CHECK_SWAP) total += intel_get_total_swap_mb(); total *= 1024 * 1024;