Skip to content

Commit

Permalink
x86: Use clflushopt in clflush_cache_range
Browse files Browse the repository at this point in the history
If clflushopt is available on the system, use it instead of clflush in
clflush_cache_range.

Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>
Link: http://lkml.kernel.org/r/1393441612-19729-3-git-send-email-ross.zwisler@linux.intel.com
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
  • Loading branch information
Ross Zwisler authored and H. Peter Anvin committed Feb 27, 2014
1 parent 171699f commit 8b80fd8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions arch/x86/mm/pageattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ within(unsigned long addr, unsigned long start, unsigned long end)
* @vaddr: virtual start address
* @size: number of bytes to flush
*
* clflush is an unordered instruction which needs fencing with mfence
* to avoid ordering issues.
* clflushopt is an unordered instruction which needs fencing with mfence or
* sfence to avoid ordering issues.
*/
void clflush_cache_range(void *vaddr, unsigned int size)
{
Expand All @@ -136,11 +136,11 @@ void clflush_cache_range(void *vaddr, unsigned int size)
mb();

for (; vaddr < vend; vaddr += boot_cpu_data.x86_clflush_size)
clflush(vaddr);
clflushopt(vaddr);
/*
* Flush any possible final partial cacheline:
*/
clflush(vend);
clflushopt(vend);

mb();
}
Expand Down

0 comments on commit 8b80fd8

Please sign in to comment.