I wonder how kernel puts data on LLC or L3 caches in detail. I have been searching the information about using cache in kernel but many results talk about page cache or buffered cache but in this question it is only related to cache above the main memory.
Assume that I make a working set or data structure (30MB) in the kernel context by using kmalloc
, vmalloc
or whatever. What I am thinking is that there might be a different procedure such as protection or extra optimization to prevent any memory violation in kernel unlike using malloc
or mmap
in user context.
Therefore, if I make a same-size working set(30MB) using user library(malloc
) in user mode, I would expect that I might get different performance when I access this data in the working set.
Question
1. How kernel uses LLC cache?
2. Can I get different performance when I allocate memory using malloc?