diff options
author | Mike Rapoport <rppt@linux.vnet.ibm.com> | 2018-06-30 10:55:00 -0400 |
---|---|---|
committer | Jonathan Corbet <corbet@lwn.net> | 2018-08-02 14:17:27 -0400 |
commit | 58faef9328f7d66b377cb34a20331c4310cdbd5e (patch) | |
tree | f8d51d4f0fdac07b7438268b334bc667afb6b7c3 /mm/bootmem.c | |
parent | a83c0ea79d8b5705d09a39c73224332f9170a903 (diff) |
docs/mm: bootmem: add overview documentation
Signed-off-by: Mike Rapoport <rppt@linux.vnet.ibm.com>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Diffstat (limited to 'mm/bootmem.c')
-rw-r--r-- | mm/bootmem.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/mm/bootmem.c b/mm/bootmem.c index 76fc17eb78ae..97db0e8e362b 100644 --- a/mm/bootmem.c +++ b/mm/bootmem.c | |||
@@ -21,6 +21,53 @@ | |||
21 | 21 | ||
22 | #include "internal.h" | 22 | #include "internal.h" |
23 | 23 | ||
24 | /** | ||
25 | * DOC: bootmem overview | ||
26 | * | ||
27 | * Bootmem is a boot-time physical memory allocator and configurator. | ||
28 | * | ||
29 | * It is used early in the boot process before the page allocator is | ||
30 | * set up. | ||
31 | * | ||
32 | * Bootmem is based on the most basic of allocators, a First Fit | ||
33 | * allocator which uses a bitmap to represent memory. If a bit is 1, | ||
34 | * the page is allocated and 0 if unallocated. To satisfy allocations | ||
35 | * of sizes smaller than a page, the allocator records the Page Frame | ||
36 | * Number (PFN) of the last allocation and the offset the allocation | ||
37 | * ended at. Subsequent small allocations are merged together and | ||
38 | * stored on the same page. | ||
39 | * | ||
40 | * The information used by the bootmem allocator is represented by | ||
41 | * :c:type:`struct bootmem_data`. An array to hold up to %MAX_NUMNODES | ||
42 | * such structures is statically allocated and then it is discarded | ||
43 | * when the system initialization completes. Each entry in this array | ||
44 | * corresponds to a node with memory. For UMA systems only entry 0 is | ||
45 | * used. | ||
46 | * | ||
47 | * The bootmem allocator is initialized during early architecture | ||
48 | * specific setup. Each architecture is required to supply a | ||
49 | * :c:func:`setup_arch` function which, among other tasks, is | ||
50 | * responsible for acquiring the necessary parameters to initialise | ||
51 | * the boot memory allocator. These parameters define limits of usable | ||
52 | * physical memory: | ||
53 | * | ||
54 | * * @min_low_pfn - the lowest PFN that is available in the system | ||
55 | * * @max_low_pfn - the highest PFN that may be addressed by low | ||
56 | * memory (%ZONE_NORMAL) | ||
57 | * * @max_pfn - the last PFN available to the system. | ||
58 | * | ||
59 | * After those limits are determined, the :c:func:`init_bootmem` or | ||
60 | * :c:func:`init_bootmem_node` function should be called to initialize | ||
61 | * the bootmem allocator. The UMA case should use the `init_bootmem` | ||
62 | * function. It will initialize ``contig_page_data`` structure that | ||
63 | * represents the only memory node in the system. In the NUMA case the | ||
64 | * `init_bootmem_node` function should be called to initialize the | ||
65 | * bootmem allocator for each node. | ||
66 | * | ||
67 | * Once the allocator is set up, it is possible to use either single | ||
68 | * node or NUMA variant of the allocation APIs. | ||
69 | */ | ||
70 | |||
24 | #ifndef CONFIG_NEED_MULTIPLE_NODES | 71 | #ifndef CONFIG_NEED_MULTIPLE_NODES |
25 | struct pglist_data __refdata contig_page_data = { | 72 | struct pglist_data __refdata contig_page_data = { |
26 | .bdata = &bootmem_node_data[0] | 73 | .bdata = &bootmem_node_data[0] |