OSDN Git Service

drm/i915: Batch copy_from_user for relocation processing
authorChris Wilson <chris@chris-wilson.co.uk>
Sat, 24 Mar 2012 20:12:53 +0000 (20:12 +0000)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Mon, 26 Mar 2012 07:59:05 +0000 (09:59 +0200)
commit1d83f4426fa0555c98c989915be6df01a8125aca
tree20252ea39d4e57cec394d8fcffd160a6f38128fd
parent0fb3f969c8683505fb7323c06bf8a999a5a45a15
drm/i915: Batch copy_from_user for relocation processing

Originally the code tried to allocate a large enough array to perform
the copy using vmalloc, performance wasn't great and throughput was
improved by processing each individual relocation entry separately.
This too is not as efficient as one would desire. A compromise would be
to allocate a single page, or to allocate a few entries on the stack,
and process the copy in batches. The latter gives simpler code and more
consistent performance due to a lack of heuristic.

x11perf -copywinwin10: n450/pnv i3-330m i5-2520m (cpu)
               before:    249000  785000  1280000 (80%)
                 page:   264000  896000  1280000 (65%)
             on-stack:   264000  902000  1280000 (67%)

v2: Use 512-bytes of stack for batching rather than allocate a page.
v3: Tidy the code slightly with more descriptive variable names

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/i915_gem_execbuffer.c