xref: /OK3568_Linux_fs/kernel/Documentation/core-api/boot-time-mm.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun===========================
2*4882a593SmuzhiyunBoot time memory management
3*4882a593Smuzhiyun===========================
4*4882a593Smuzhiyun
5*4882a593SmuzhiyunEarly system initialization cannot use "normal" memory management
6*4882a593Smuzhiyunsimply because it is not set up yet. But there is still need to
7*4882a593Smuzhiyunallocate memory for various data structures, for instance for the
8*4882a593Smuzhiyunphysical page allocator.
9*4882a593Smuzhiyun
10*4882a593SmuzhiyunA specialized allocator called ``memblock`` performs the
11*4882a593Smuzhiyunboot time memory management. The architecture specific initialization
12*4882a593Smuzhiyunmust set it up in :c:func:`setup_arch` and tear it down in
13*4882a593Smuzhiyun:c:func:`mem_init` functions.
14*4882a593Smuzhiyun
15*4882a593SmuzhiyunOnce the early memory management is available it offers a variety of
16*4882a593Smuzhiyunfunctions and macros for memory allocations. The allocation request
17*4882a593Smuzhiyunmay be directed to the first (and probably the only) node or to a
18*4882a593Smuzhiyunparticular node in a NUMA system. There are API variants that panic
19*4882a593Smuzhiyunwhen an allocation fails and those that don't.
20*4882a593Smuzhiyun
21*4882a593SmuzhiyunMemblock also offers a variety of APIs that control its own behaviour.
22*4882a593Smuzhiyun
23*4882a593SmuzhiyunMemblock Overview
24*4882a593Smuzhiyun=================
25*4882a593Smuzhiyun
26*4882a593Smuzhiyun.. kernel-doc:: mm/memblock.c
27*4882a593Smuzhiyun   :doc: memblock overview
28*4882a593Smuzhiyun
29*4882a593Smuzhiyun
30*4882a593SmuzhiyunFunctions and structures
31*4882a593Smuzhiyun========================
32*4882a593Smuzhiyun
33*4882a593SmuzhiyunHere is the description of memblock data structures, functions and
34*4882a593Smuzhiyunmacros. Some of them are actually internal, but since they are
35*4882a593Smuzhiyundocumented it would be silly to omit them. Besides, reading the
36*4882a593Smuzhiyundescriptions for the internal functions can help to understand what
37*4882a593Smuzhiyunreally happens under the hood.
38*4882a593Smuzhiyun
39*4882a593Smuzhiyun.. kernel-doc:: include/linux/memblock.h
40*4882a593Smuzhiyun.. kernel-doc:: mm/memblock.c
41*4882a593Smuzhiyun   :functions:
42