Zen has CLZERO which can clear a cacheline in one go, but not sure how good it is.
Zen has CLZERO which can clear a cacheline in one go, but not sure how good it is.
There is a definite need to do hundreds of MB - the Linux kernel has a background thread that does nothing but zero out pages. What do you think happens to the GBs of RAM freed by closing Chrome? Once it’s made available in one spot, no reason others could use it (eg a hardened malloc implementation, etc).
Additionally, CLZERO ends up doing very similar work since the resulting cache flush os seen by the RAM controller as a block write.
On a similar note part of ATI 2000 https://en.wikipedia.org/wiki/HyperZ was fast Z clear, today a norm on every GPU.
Not hundreds but in one of my apps I do have 10th MB of continuous cache that has to be zeroed before use / reuse.
It returns the memory to the OS, and will pagefault on later accesses remapping them as zero-filled. It works in pages. Sizes smaller than a page result in whatever else is in the same page getting nuked.
If you don't immediately reuse the whole cache, it might spread out the zeroing/remapping over time, rather than in a single large go. Imagine some testing would be in order to see if a syscall + mapping changes ( require reloading with TLB for the process ? ) would be smaller than a straight run of writing zeros at some point.
IIRC, the zeroing is not something you can expect from non-linux madvise implementations.