From: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxx> We can decrease the i915 slab usage by 1-6 MiB* easily by doing more sg list coalescing and having the tables at the correct size at the same time. This series extracts the sg table building code into helper so that all places in i915 can benefit. Another problem is that it is hard to know in advance how many entries we will need (due coalescing). Rather than try to pre-scan the pages before creating the table, it looks easier to keep our pessimistic table sizing at creation, and trim the waste afterwards. *** There is a bug here somewhere so please don't run it. *** *** I am sending it as RFC only since my debug capabilities *** *** are severely limited at the moment. *** *) I measured the memory savings by looking at the unused number of sg entries at some points: * Logging into KDE there is 1-2 MiB of unused sg entries. * Running the T-Rex benchamrk aroun 3 Mib. * Similarly for Manhattan 5-6 MiB. Tvrtko Ursulin (7): drm/i915: Extract sg creation into a helper drm/i915: Use i915_sg_create for userptr drm/i915: Use i915_sg_create for partial views drm/i915: Use i915_sg_create for rotated pages view drm/i915: Use i915_sg_create for dmabuf lib/scatterlist: Add sg_trim_table drm/i915: Trim sg table after creating it drivers/gpu/drm/i915/i915_drv.h | 34 +++++ drivers/gpu/drm/i915/i915_gem.c | 218 +++++++++++++++++++++++++------- drivers/gpu/drm/i915/i915_gem_dmabuf.c | 45 +++---- drivers/gpu/drm/i915/i915_gem_gtt.c | 76 ++++------- drivers/gpu/drm/i915/i915_gem_userptr.c | 51 ++------ include/linux/scatterlist.h | 2 + lib/scatterlist.c | 53 ++++++++ 7 files changed, 314 insertions(+), 165 deletions(-) -- 2.7.4 _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx