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)
+       sg_trim_table(st);
        return st;

Intel-gfx mailing list

Reply via email to