diff mbox

[RFC,7/7] drm/i915: Trim sg table after creating it

Message ID 1476349444-7331-8-git-send-email-tvrtko.ursulin@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Tvrtko Ursulin Oct. 13, 2016, 9:04 a.m. UTC
From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

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 <tvrtko.ursulin@intel.com>
---
 drivers/gpu/drm/i915/i915_gem.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox

Patch

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;
 }