Skip to content

RFC Save megabytes of wasted sg entries

Tvrtko Ursulin intel-gfx 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest7 patches 10 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/7drm/i915: Extract sg creation into a helperdrivers/gpu/drm/i915/i915_gem.c+109 -443 replies
2/7drm/i915: Use i915_sg_create for userptrdrivers/gpu/drm/i915/i915_drv.h drivers/gpu/drm/i915/i915_gem.c drivers/gpu/drm/i915/i915_gem_userptr.c+87 -620 replies
3/7drm/i915: Use i915_sg_create for partial viewsdrivers/gpu/drm/i915/i915_drv.h drivers/gpu/drm/i915/i915_gem.c drivers/gpu/drm/i915/i915_gem_gtt.c+47 -260 replies
4/7drm/i915: Use i915_sg_create for rotated pages viewdrivers/gpu/drm/i915/i915_gem_gtt.c+14 -280 replies
5/7drm/i915: Use i915_sg_create for dmabufdrivers/gpu/drm/i915/i915_gem_dmabuf.c+20 -252 replies
6/7lib/scatterlist: Add sg_trim_tableinclude/linux/scatterlist.h lib/scatterlist.c+55 -02 replies
7/7drm/i915: Trim sg table after creating itdrivers/gpu/drm/i915/i915_gem.c+2 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC 0/7] Save megabytes of wasted sg entries

From: Tvrtko Ursulin <[email protected]>

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(-)
Signature · 6 lines
2.7.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx