[Intel-gfx] [RFC 7/7] drm/i915: Trim sg table after creating it

Tvrtko Ursulin tursulin at ursulin.net
Thu Oct 13 09:04:04 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 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;
 }
 
-- 
2.7.4



More information about the Intel-gfx mailing list