drm: Avoid the double clflush on the last cache line in drm_clflush_virt_range()
[deliverable/linux.git] / drivers / gpu / drm / drm_cache.c
index 9a62d7a53553d3a54f45d0ef0cbc1291de84fc08..6743ff7dccfa30b2997d2529d97747d5261d5ad9 100644 (file)
@@ -130,11 +130,12 @@ drm_clflush_virt_range(void *addr, unsigned long length)
 {
 #if defined(CONFIG_X86)
        if (cpu_has_clflush) {
+               const int size = boot_cpu_data.x86_clflush_size;
                void *end = addr + length;
+               addr = (void *)(((unsigned long)addr) & -size);
                mb();
-               for (; addr < end; addr += boot_cpu_data.x86_clflush_size)
+               for (; addr < end; addr += size)
                        clflushopt(addr);
-               clflushopt(end - 1);
                mb();
                return;
        }
This page took 0.02448 seconds and 5 git commands to generate.