I found that physical memory is split into ranks as follows (Memory Interleaving):
rank0: [0-512KB] [2048KB-2560KB] [4096KB-4608KB] ...
rank1: [512KB-1024KB] [2560KB-3072KB] [4608KB-5120KB] ...
rank2: [1024KB-1536KB] [3072KB-3584KB] [5120KB-...
rank3: [1536KB-2048KB] [3584KB-4096KB] ...
Linux kernel is getting these interleaved memory. So, the physical memory seen by linux kernel is not contiguous. Correct me if I am wrong about this.
I have been looking at linux kernel source code for my course work.
While creating sysfs (/sys/devices/system/memory), linux kernel creates the sections(memory0, memory1,...) of certain size(128 MB on my system) of these available physical memory. Using state files in these directories I can make sections offline/Online. (Memory Hotplug)
So, physical memory represented by these sections is scattered. So, if I make any of the section offline that will make that scattered memory it is pointing to unavailable.
I want to make these sections refer to contiguous memory. something like this :
memory0 : 0-128 MB
memory1 : 128-256 MB
....
So, when I make some section offline then contiguous physical memory related to that section becomes unavailable. So, can I make linux kernel see physical memory as contiguous instead of interleaved?
Correct me if I am wrong about any of this.
Thank you.