How to use continuous memory in linux kernel?

I found that physical memory is divided into ranking as follows (memory rotation):

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] ... 

The Linux kernel receives this striped memory. Thus, the physical memory visible by the Linux kernel is not continuous. Correct me if I am wrong.

I studied the source code of the Linux kernel for my work.

When creating sysfs (/ sys / devices / system / memory), the linux kernel creates partitions (memory0, memory1, ...) of a certain size (128 MB on my system) from this available physical memory. Using state files in these directories, I can make sections offline / online. ( Hotplug memory )

Thus, the physical memory represented by these sections is scattered. So, if I do any of the partitions offline that will make this scattered memory, it indicates inaccessibility.

I want these sections to reference continuous memory. something like that:

  memory0 : 0-128 MB memory1 : 128-256 MB .... 

So, when I do some kind of partition offline, the adjacent physical memory associated with this sector becomes inaccessible. So, can I make the linux kernel see physical memory as contiguous rather than striped?

Correct me if I am wrong about this.

Thanks.

+6
source share
1 answer

I think that what you see is related to the interleave option for allocating memory in NUMA. There is very good paper that talks about NUMA under Linux.

Without the details of the hardware you are using, it is very difficult to guess how you can disable the memory strip option. You should also look into the numactl utility to find out if it has any parameter that can be used on a running system. There are also some blog posts mentioning BIOS parameter changes to control the ability to strip memory, and you may have to do the same. (Not having the right to give 2 links right now: \, but a simple Google search when disabling memory striping in the BIOS should be useful to you)

+1
source

Source: https://habr.com/ru/post/956789/


All Articles