[PATCH 6/6] drm/i915: Trim sg table after creating it

Tvrtko Ursulin tursulin at ursulin.net
Tue Oct 18 14:19:20 UTC 2016


From: Tvrtko Ursulin <tvrtko.ursulin at 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 at intel.com>
---
 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 d2ac29373124..54dba6379016 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -2345,6 +2345,8 @@ struct sg_table *i915_sg_complete(struct i915_sg_create_state *state)
 
 	kfree(state);
 
+	sg_trim_table(st);
+
 	return st;
 }
 
-- 
2.7.4



More information about the Intel-gfx-trybot mailing list