3 ms·
COW isn't free. You still have to spend the time doing the copy. Better to zero memory ahead of time.
by ars 12y ago
COW isn't free. You still have to spend the time doing the copy.
Better to zero memory ahead of time.
- fulafel 12y agoWindows-style ahead of time zeroing thread will typically take the cache misses and memory bandwidth for that page twice. (Assuming your code subsequently puts its own data on the pages, instead of just ordering up zeroed pages to sit on)
- kevingadd 12y agoAre you certain it's not bypassing cache on the writes? It's been relatively straightforward to do this on x86 for ages now, especially if you're using SSE to fill many bytes at once. I would be shocked if the page zeroing thread did cached reads or writes.
- brucedawson 12y agoThe page-zeroing code may be able to minimize its effect on the cache, but it will then necessarily consume memory bandwidth -- 4 KB of bandwidth per page zeroed as it writes each page. So, it still affects overall performance. And it guarantees that when a process goes to use the pages they will not be in the cache. Ah, tradeoffs.
- ars 12y agoIt does it when the system is otherwise idle. > And it guarantees that when a process goes to use the pages they will not be in the cache. There isn't much point in caching a page full of zeros. Let the cache fill when there is actual data.
- deleted 12y ago[deleted]