/**
* clflush_cache_range - flush a cache range with clflush
* @vaddr: virtual start address
* @size: number of bytes to flush
*
* 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)
{
void *vend = vaddr + size - 1;
mb();
for (; vaddr < vend; vaddr += boot_cpu_data.x86_clflush_size)
clflushopt(vaddr);
/*
* Flush any possible final partial cacheline:
*/
clflushopt(vend);
mb();
}
clflush_cache_range()
函数用来把从虚拟地址vaddr
起始的,长度为size
的的cache line
置为无效,各级包含这个cache line
的cache
系统都会失效。