I am wondering if there is any information on how to tell if two given physical memory addresses are in the same memory bank. I am working on x86 multicore architecture and need to hack memory access performance on task level.
Thanks in advance /Peng
EDIT: Turns out it's more complicated than I realized. As Mark Seaborn and plafratt pointed out in comments, the diagram below is just an example of how physical address mapping might be implemented. Further reading confirms that memory controllers can do this mapping in any number of different ways. Read the excellent writeup linked in Mark's answer for more details, and for further reading, this article provides some additional insight from a programmer's perspective. I'm leaving the original answer here because it provides a practical example (edited to say this is just an example).
-- Original Answer --
Here is an example of how 32-bit physical addresses might be mapped*:
Bits 12-0 identify the byte within the 8KB page.
Bits 16-13 identify which of the 16 memory channels the system should use for this address.
Bits 20-17 identify which of the 16 banks the address will be found in.
Bits 32-21 identify which row within the bank is accessed.
So if you have two physical addresses, you should be able to compare bits 17-20 to determine whether or not they are in the same bank.
*Credit: http://www.futurechips.org/chip-design-for-all/what-every-programmer-should-know-about-the-memory-system.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With