Linux buddyinfo

From Leo's Notes
Last edited on 20 November 2023, at 22:35.

In Linux, understanding the output of /proc/puddyinfo is helpful when diagnosing memory issues.

Example output[edit | edit source]

On a Linux system with 3TB of memory installed, this is what /proc/buddyinfo looks like:

# cat /proc/buddyinfo | column -t
Node  0,  zone  DMA     0        0        0        0        0       0      0      0     1     1  2
Node  0,  zone  DMA32   3        4        4        1        3       1      3      3     3     2  360
Node  0,  zone  Normal  5987     3535     15411    2939     990     227    110    56    296   0  0
Node  1,  zone  Normal  340611   348961   3195042  3452371  461840  13472  673    58    1     0  0
Node  2,  zone  Normal  8662816  6463200  5923202  2292623  299873  23766  10924  5156  1101  3  54266
Node  3,  zone  Normal  167      322      153      437      249     134    69     42    27    6  188034

A few keypoints to understand from this output:

  • Each Node represents a CPU
  • There are 3 types of zones.
    • On 64bit systems, DMA references the first 16MB, DMA32 is 16MB - 4GB and lower, and Normal is everything after 4GB.
  • Each column represents the number of available pages of a particular size. Intel systems have a memory page size of 4096 bytes (run getconf PAGESIZE)
    • 1st column: 2^0 * PAGE SIZE. 4k
    • 2nd column: 2^1 * PAGE SIZE. 8k
    • 3rd column: 2^2 * PAGE SIZE. 16k
    • 4th column: 2^3 * PAGE SIZE. 32k
    • 5th column: 2^4 * PAGE SIZE. 64k
    • ...
    • 11th column: 2^10 * PAGE SIZE. 4M