Object file section efficiency
Hello, Suppose I have some initialized data stored in the .data section of my kernel module. Now, as it turns out, that data should have been made constant, but the latter 'const' linkage qualifer was left off of the declaration of the variable. This led me to the following question: Are there any memory efficiencies with how the kernel loads the .data vs the .rodata sections into memory? Will the information stored in .rodata have better cache performance than that stored in .data? -Matt
On Mon, 24 Feb 2014 12:44:33 -0800, Matt Davis said:
Are there any memory efficiencies with how the kernel loads the .data vs the .rodata sections into memory? Will the information stored in .rodata have better cache performance than that stored in .data?
Yes/no/maybe. It's mostly going to depend on whether there's any *other* hot data in the same cache line. There's been a number of patches that re-organize various structs that are larger than a cache line so that all the hot data is in the same line. There's also been patches to *split* data across 2 cache lines to avoid ping-ponging (where CPU 1 is beating up on variable A, and CPU 2 is beating up on not-very-related variable B, and they just keep shooting down the cache line).
participants (2)
-
Matt Davis -
Valdis.Kletnieks@vt.edu