Commit 87229ad9 authored by Dave Airlie's avatar Dave Airlie Committed by Dave Airlie

drm: micro optimise cache flushing

We hit this a lot with i915 and although we'd like to engineer things to hit
it a lot less, this commit at least makes it consume a few less cycles.

from something containing
movzwl 0x0(%rip),%r10d
to
add    %r8,%rdx

I only noticed it while using perf to profile something else.
Reviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent f2032d41
...@@ -37,12 +37,13 @@ drm_clflush_page(struct page *page) ...@@ -37,12 +37,13 @@ drm_clflush_page(struct page *page)
{ {
uint8_t *page_virtual; uint8_t *page_virtual;
unsigned int i; unsigned int i;
const int size = boot_cpu_data.x86_clflush_size;
if (unlikely(page == NULL)) if (unlikely(page == NULL))
return; return;
page_virtual = kmap_atomic(page); page_virtual = kmap_atomic(page);
for (i = 0; i < PAGE_SIZE; i += boot_cpu_data.x86_clflush_size) for (i = 0; i < PAGE_SIZE; i += size)
clflush(page_virtual + i); clflush(page_virtual + i);
kunmap_atomic(page_virtual); kunmap_atomic(page_virtual);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment