From patchwork Thu Oct 13 09:04:04 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tvrtko Ursulin X-Patchwork-Id: 9374585 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 76CFF60839 for ; Thu, 13 Oct 2016 09:04:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 667DD29E72 for ; Thu, 13 Oct 2016 09:04:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5B4D229E7D; Thu, 13 Oct 2016 09:04:42 +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=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID 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 110DF29E72 for ; Thu, 13 Oct 2016 09:04:42 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 798BC6E9C5; Thu, 13 Oct 2016 09:04:41 +0000 (UTC) X-Original-To: Intel-gfx@lists.freedesktop.org Delivered-To: Intel-gfx@lists.freedesktop.org Received: from mail-lf0-x243.google.com (mail-lf0-x243.google.com [IPv6:2a00:1450:4010:c07::243]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1BC3F6E9C0 for ; Thu, 13 Oct 2016 09:04:23 +0000 (UTC) Received: by mail-lf0-x243.google.com with SMTP id x23so5833608lfi.1 for ; Thu, 13 Oct 2016 02:04:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ursulin-net.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=YAsEbX3TSFLG1p4Id/7Up5j3W8T6gM5FXRCZKRcQFhY=; b=cHQI2CnY2h62JkYNiC2syP/m2/3kspyfWjMAZ/PLWOVBEZtNAe7/qc7dc/UV3pE6D8 CCfRFPm39TXKb13STOyPGOfMGr1XqzeMbZjulnxM2DI4eGjvmNYcDfY+u9nqg9cZNF3D 9JRCS3c+lA7g2KkFk5UI/9J8vtqRpqM/WXDK7jCX5HEfNQun8BLKQ6LnGNiypp71wZAd WLFREAxVwqBLhNQkQPRsD+ECgtu+quuUoBa4oTn7D/zJbEt4ViBdyKW6YNJy5NAQmmHc eV5Y1tnELaCaDTnvqcX1byxyWII1gRpH5X+L6o/e5qCyMkDkp2HZqgbaiUVm8CC1vZuM hZ7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=YAsEbX3TSFLG1p4Id/7Up5j3W8T6gM5FXRCZKRcQFhY=; b=maNNN015GShAZ79bgQum88hVhjjU23LeILnire7h3xbykrztKRd2Pwk74dJF1PkS7G rM4zZmoNdmlr6KQ51feE7oX57tF0pJKUvKiP4GiwjmXgBtCgNd3mOi2mPnykIcUaIR47 ihXIvYdxtNKRTR37B9xjEkNaWLftFvhmYP19xDAobSED9ZqrehPDxUeV56CsBFnAnH73 +Z51aE1U3XHFQdYyewasRh0yON56nBV3n9eOoV7tyuE0npL5leB90g8bfpVOqvWWZQJj F/YxMcDOhBwH0bgZAfOOGKGVl2LcvpxLDOv2l0Tpi1DvTn1lxjqx7M1Lmi/JCgFoO5YT qTwQ== X-Gm-Message-State: AA6/9RmczZMaFPg6pE8kh2dosmeVcN1EoLc8lp91+7GGNhfxLMWeLqUcLdiIA19vu5i7cw== X-Received: by 10.28.194.134 with SMTP id s128mr1365095wmf.26.1476349461016; Thu, 13 Oct 2016 02:04:21 -0700 (PDT) Received: from localhost.localdomain ([2a02:c7d:9b6d:e300:916a:6cab:ac67:71c2]) by smtp.gmail.com with ESMTPSA id y2sm20776894wjx.20.2016.10.13.02.04.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Oct 2016 02:04:20 -0700 (PDT) From: Tvrtko Ursulin X-Google-Original-From: Tvrtko Ursulin To: Intel-gfx@lists.freedesktop.org Date: Thu, 13 Oct 2016 10:04:04 +0100 Message-Id: <1476349444-7331-8-git-send-email-tvrtko.ursulin@linux.intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1476349444-7331-1-git-send-email-tvrtko.ursulin@linux.intel.com> References: <1476349444-7331-1-git-send-email-tvrtko.ursulin@linux.intel.com> Subject: [Intel-gfx] [RFC 7/7] drm/i915: Trim sg table after creating it 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: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP From: Tvrtko Ursulin Since most of our callers do not know in advance how many entries in the sg table they will need, it is beneficial to trim the table after it has been created. Use the newly added sg_trim_table to do that when i915_sg_complete is called. Before we were wasting between 1-2 MiB of space on unused sg entries just when logging into an idle desktop (KDE), around 3 MiB while running the T-Rex benchmark or around 5-6 MiB with Manhattan. Signed-off-by: Tvrtko Ursulin --- drivers/gpu/drm/i915/i915_gem.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 05dc2af1a89e..1b722c5ebb26 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c @@ -2347,6 +2347,8 @@ struct sg_table *i915_sg_complete(struct i915_sg_create_state *state) kfree(state); + sg_trim_table(st); + return st; }