Skip to content
Advertisement

How to clear CPU cached owned by a process in Linux x86

I want to get the kernel APIs which can be used to flush/clear the CPU cache owned by a specific process.

Advertisement

Answer

There’s no such thing as “CPU cache owned by a process”.

The CPU / memory controller manages the cache, not the OS.

On some CPU architectures (I don’t know!) it might be possible to explicitly instruct the caches to evoke (“invalidate”) certain cache lines, but that’s probably more along the lines of pretty specific DMA controller commands than a Linux API thing.

I think your question might be born from a superficial understanding of Meltdown/Spectre. If that’s the case: re-read the original papers and read up on x86 CPU cache implementations.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement