3 ms·
Of course :) But the OS could get involved for larger blocks of memory. Also, I wonder if zeroing large chunks of memory would be faster to do in kernel space
by Manishearth 10y ago
Of course :) But the OS could get involved for larger blocks of memory.
Also, I wonder if zeroing large chunks of memory would be faster to do in kernel space using real addresses. You can avoid the multiple real memory lookups involved in a single virtual write.
(Of course, we already avoid those often, but it could be useful to avoid entirely. Not sure what the tradeoffs are here)
- caf 10y agoPaging is still enabled in kernel mode, the kernel uses virtual addresses. (The kernel's linear mapping of physical memory can take advantage of huge pages though, which means that there might be one or two less levels of page tables involved with those addresses). TLB misses aren't significant if you're bulk-writing to a block of memory anyway, you'll max out the bandwidth of the memory without that being an issue.
- adrianN 10y agoFor linear access patterns the TLB does its job perfectly. The overhead is negligible.