]> git.baikalelectronics.ru Git - kernel.git/commit
drm/i915: Trim the object sg table
authorTvrtko Ursulin <tvrtko.ursulin@intel.com>
Wed, 9 Nov 2016 15:13:43 +0000 (15:13 +0000)
committerTvrtko Ursulin <tvrtko.ursulin@intel.com>
Thu, 10 Nov 2016 09:29:25 +0000 (09:29 +0000)
commit9a00fbf3bb496daa2afe1448dab2a6fd5b163e2f
tree76cd8bbf6e8bbc867b9938ba0bc786d70943d353
parentaa60fc908e55346121ef4280e4deb8eb85b13292
drm/i915: Trim the object sg table

At the moment we allocate enough sg table entries assuming we
will not be able to do any coalescing. But since in practice
we most often can, and more so very effectively, this ends up
wasting a lot of memory.

A simple and effective way of trimming the over-allocated
entries is to copy the table over to a new one allocated to the
exact size.

Experiments on my freshly logged and idle desktop (KDE) showed
that by doing this we can save approximately 1 MiB of RAM, or
when running a typical benchmark like gl_manhattan I have
even seen a 6 MiB saving.

More complicated techniques such as only copying the last used
page and freeing the rest are left to the reader.

v2:
 * Update commit message.
 * Use temporary sg_table on stack. (Chris Wilson)

v3:
 * Commit message update.
 * Comment added.
 * Replace memcpy with copy assignment.
   (Chris Wilson)

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: http://patchwork.freedesktop.org/patch/msgid/1478704423-7447-1-git-send-email-tvrtko.ursulin@linux.intel.com
drivers/gpu/drm/i915/i915_gem.c