drm: micro optimise cache flushing
Subsystems (2)
Dave Airlie
maintainerPATCH 1/1 drm: micro optimise cache flushing
From: Dave Airlie <[email protected]>
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.
--- drivers/gpu/drm/drm_cache.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_cache.c +2 -1
@@ -37,12 +37,13 @@ drm_clflush_page(struct page *page) {uint8_t *page_virtual;unsigned int i; +const int size = boot_cpu_data.x86_clflush_size;if (unlikely (page ==NULL ))return ; 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);kunmap_atomic (page_virtual); }
Signature · 1 line
1.7.12
Quoted 5 lines · Dave Airlie
From: Dave Airlie <[email protected]>
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.
Quoted 8 lines
from something containing
movzwl 0x0(%rip),%r10d
to
add %r8,%rdxI only noticed it while using perf to profile something else.
Signed-off-by Dave Airlie <[email protected]>
I would have thought this is something the compiler should, with the appropriate hints, be smart enough to decide for itself as boot_cpu_data should be constant once defined. *shrug*
-Chris
Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
Quoted 11 lines · Chris Wilson
Quoted 10 lines · Dave Airlie
From: Dave Airlie <[email protected]>
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
Quoted 8 lines
Quoted 3 lines
I only noticed it while using perf to profile something else.
Signed-off-by Dave Airlie <[email protected]>Reviewed-by Chris Wilson <[email protected]>I would have thought this is something the compiler should, with the appropriate hints, be smart enough to decide for itself as
boot_cpu_datashould be constant once defined. *shrug*
Since it's not obvious the compiler isn't smart enough, should the code carry a comment so we don't forget?
BR,
Jani.