CONTRIBUTING.d/patches: Please provide a git-range-diff(1)
[man-pages.git] / man5 / proc_buddyinfo.5
blob3bdae717ea38e0ff2ba35c3b228b705291d109fe
1 .\" Copyright (C) 1994, 1995, Daniel Quinlan <quinlan@yggdrasil.com>
2 .\" Copyright (C) 2002-2008, 2017, Michael Kerrisk <mtk.manpages@gmail.com>
3 .\" Copyright (C) 2023, Alejandro Colomar <alx@kernel.org>
4 .\"
5 .\" SPDX-License-Identifier: GPL-3.0-or-later
6 .\"
7 .TH proc_buddyinfo 5 (date) "Linux man-pages (unreleased)"
8 .SH NAME
9 /proc/buddyinfo \- memory fragmentation
10 .SH DESCRIPTION
11 .TP
12 .I /proc/buddyinfo
13 This file contains information which is used for diagnosing memory
14 fragmentation issues.
15 Each line starts with the identification of the node and the name
16 of the zone which together identify a memory region.
17 This is then
18 followed by the count of available chunks of a certain order in
19 which these zones are split.
20 The size in bytes of a certain order is given by the formula:
21 .IP
22 .in +4n
23 .EX
24 (2\[ha]order)\ *\ PAGE_SIZE
25 .EE
26 .in
27 .IP
28 The binary buddy allocator algorithm inside the kernel will split
29 one chunk into two chunks of a smaller order (thus with half the
30 size) or combine two contiguous chunks into one larger chunk of
31 a higher order (thus with double the size) to satisfy allocation
32 requests and to counter memory fragmentation.
33 The order matches the column number, when starting to count at zero.
34 .IP
35 For example on an x86-64 system:
36 .RS -12
37 .EX
38 Node 0, zone     DMA     1    1    1    0    2    1    1    0    1    1    3
39 Node 0, zone   DMA32    65   47    4   81   52   28   13   10    5    1  404
40 Node 0, zone  Normal   216   55  189  101   84   38   37   27    5    3  587
41 .EE
42 .RE
43 .IP
44 In this example, there is one node containing three zones and there
45 are 11 different chunk sizes.
46 If the page size is 4 kilobytes, then the first zone called
47 .I DMA
48 (on x86 the first 16 megabyte of memory) has 1 chunk of 4 kilobytes
49 (order 0) available and has 3 chunks of 4 megabytes (order 10) available.
50 .IP
51 If the memory is heavily fragmented, the counters for higher
52 order chunks will be zero and allocation of large contiguous areas
53 will fail.
54 .IP
55 Further information about the zones can be found in
56 .IR /proc/zoneinfo .
57 .SH SEE ALSO
58 .BR proc (5)