Linux Kernel Architecture

(Jacob Rumans) #1

Chapter3:MemoryManagement


❑ node_zonesis an array that holds the data structures of the zones in the node.
❑ node_zonelistsspecifies alternative nodes and their zones in the order in which they are used
for memory allocation if no more space is available in the current zone.
❑ The number of different zones in the node is held innr_zones.
❑ node_mem_mapis a pointer to an array ofpageinstances used to describe all physical pages of the
node. It includes the pages of all zones in the node.
❑ During system boot, the kernel needs memory even before memory management has been ini-
tialized (memory must also be reserved to initialize memory management). To resolve this prob-
lem, the kernel uses the boot memory allocator described in Section 3.4.3.bdatapoints to the
instance of the data structure that characterizes the boot memory allocator.
❑ node_start_pfnis the logical number of the first page frame of the NUMA node. The page
frames ofallnodes in the system are numbered consecutively, and each frame is given a number
that is globally unique (not just unique to the node).
node_start_pfnis always 0 in a UMA system because there is only one node whose first page
frame is therefore 0.node_present_pagesspecifies the number of page frames in the zone and
node_spanned_pagesthe size of the zone in page frames. This value need not necessarily be the
same asnode_present_pagesbecausetheremaybeholesinthezonethatarenotbackedbya
real page frame.
❑ node_idis a global node identifier. All NUMA nodes in the system are numbered starting
from 0.
❑ pgdat_nextlinks the nodes in the system on a singly linked list whose end is indicated, as usual,
by a null pointer.
❑ kswapd_waitis the wait queue for the swap daemon needed when swapping frames out of the
zone (Chapter 18 deals with this at length).kswapdpoints to the task structure of the swap dae-
mon responsible for the zone.kswapd_max_orderis used in the implementation of the swapping
subsystem to define the size of the area to be freed and is currently of no interest.

The association between the node and the zones it contains and the fallback list shown in Figure 3-3 is
established by means of arrays at the beginning of the data structure.

These are not the usual pointers to arrays. The array data are held in the node struc-
ture itself.

The zones of the node are held innode_zones[MAX_NR_ZONES]. The array always has three entries, even
if the node has fewer zones. If the latter is the case, the remaining entries are filled with null elements.

Node State Management


If more than one node can be present on the system, the kernel keeps a bitmap that provides state infor-
mation for each node. The states are specified with a bitmask, and the following values are possible:

<nodemask.h>
enum node_states {
N_POSSIBLE, /* The node could become online at some point */
N_ONLINE, /* The node is online */
N_NORMAL_MEMORY, /* The node has regular memory */
#ifdef CONFIG_HIGHMEM
Free download pdf