Well, dug int some Linux and kernel System Admin Doc's and found this. I was looking for how to find what the largest block of contiguous memory is. Well at https://www.kernel.org/doc/Documenta...stems/proc.txt, it says that /proc/buddyinfo is used primarily for diagnosing memory fragmentation.
External fragmentation is a problem under some workloads, and buddyinfo is a
useful tool for helping diagnose these problems. Buddyinfo will give you a
clue as to how big an area you can safely allocate, or why a previous
allocation failed.
I tested all this on my laptop, which has 8GB of RAM. I figured that would be a bteer example than either of my servers, that have 128GB RAM.
Looking at it:
Code:
mafoelffen@Mikes-ThinkPad-T520:~/Scripts$ sudo grep . /proc/buddyinfo
Node 0, zone DMA 0 0 0 0 0 0 0 0 0 1 3
Node 0, zone DMA32 19883 7185 4058 3123 1847 1220 637 312 139 71 29
Node 0, zone Normal 22095 18552 9367 4498 739 90 233 222 93 31 7
Where:
DMA is the first 16MB
DMA32 is the above 4GB (64bit systems)
Normal is the memory between 16MB and 4GB
PAGE_SIZE is 4Mbyte
11 Columns in the table
Column 1 is 2^(0*PAGE_SIZE) chunks of memory (4kb each)
Column 2 is 2^(1*PAGE_SIZE) chunks of memory (8kb each)
Column 3 is 2^(2*PAGE_SIZE) chunks of memory (16kb each)
Column 4 is 2^(3*PAGE_SIZE) chunks of memory (32kb each)
Column 5 is 2^(4*PAGE_SIZE) chunks of memory (64kb each)
Column 6 is 2^(5*PAGE_SIZE) chunks of memory (128kb each)
Column 7 is 2^(6*PAGE_SIZE) chunks of memory (256kb each)
Column 8 is 2^(7*PAGE_SIZE) chunks of memory (512kb each)
Column 9 is 2^(8*PAGE_SIZE) chunks of memory (1024kb each)
Column 10 is 2^(9*PAGE_SIZE) chunks of memory (2048kb each)
Column 11 is 2^(10*PAGE_SIZE) chunks of memory (4096kb each)
After doing this:
Code:
sudo sysctl vm.compact_memory=1
What that should do, if it doesn't crash the kernel, is to try to consolidate pages from left to right (larger blocks) and from DMA to Normal to DMA32
This was the results of memory compaction to defragment memory:
Code:
mafoelffen@Mikes-ThinkPad-T520:~/Scripts$ sudo grep . /proc/buddyinfo
Node 0, zone DMA 0 0 0 0 0 0 0 0 0 1 3
Node 0, zone DMA32 3917 3864 3034 2818 1908 1277 688 346 153 75 29
Node 0, zone Normal 60 89 4352 1153 212 58 26 11 4 2 0