Lines Matching +full:in +full:- +full:memory

7 The memory management in Linux is a complex system that evolved over the
9 systems from MMU-less microcontrollers to supercomputers. The memory
18 Virtual Memory Primer
21 The physical memory in a computer system is a limited resource and
22 even for systems that support memory hotplug there is a hard limit on
23 the amount of memory that can be installed. The physical memory is not
29 All this makes dealing directly with physical memory quite complex and
30 to avoid this complexity a concept of virtual memory was developed.
32 The virtual memory abstracts the details of physical memory from the
33 application software, allows to keep only needed information in the
34 physical memory (demand paging) and provides a mechanism for the
37 With virtual memory, each and every memory access uses a virtual
39 writes) from (or to) the system memory, it translates the `virtual`
40 address encoded in that instruction to a `physical` address that the
41 memory controller can understand.
43 The physical system memory is divided into page frames, or pages. The
49 Each physical memory page can be mapped as one or more virtual
52 memory address. The page tables are organized hierarchically.
57 levels. The pointer to the top level page table resides in a
60 virtual address are used to index an entry in the top level page
61 table. That entry is then used to access the next level in the
63 that level page table. The lowest bits in the virtual address define
69 The address translation requires several memory accesses and memory
74 large memory working set will experience performance hit because of
77 Many modern CPU architectures allow mapping of the memory pages
78 directly by the higher levels in the page table. For instance, on x86,
79 it is possible to map 2M and even 1G pages using entries in the second
80 and the third level page tables. In Linux such pages are called
82 improves TLB hit-rate and thus improves overall system performance.
84 There are two mechanisms in Linux that enable mapping of the physical
85 memory with the huge pages. The first one is `HugeTLB filesystem`, or
87 store. For the files created in this filesystem the data resides in
88 the memory and mapped using huge pages. The hugetlbfs is described at
89 :ref:`Documentation/admin-guide/mm/hugetlbpage.rst <hugetlbpage>`.
94 the system memory should and can be mapped by the huge pages, THP
97 :ref:`Documentation/admin-guide/mm/transhuge.rst <admin_guide_transhuge>`
103 Often hardware poses restrictions on how different physical memory
104 ranges can be accessed. In some cases, devices cannot perform DMA to
105 all the addressable memory. In other cases, the size of the physical
106 memory exceeds the maximal addressable size of virtual memory and
107 special actions are required to access portions of the memory. Linux
108 groups memory pages into `zones` according to their possible
109 usage. For example, ZONE_DMA will contain memory that can be used by
110 devices for DMA, ZONE_HIGHMEM will contain memory that is not
114 The actual layout of the memory zones is hardware dependent as not all
121 Many multi-processor machines are NUMA - Non-Uniform Memory Access -
122 systems. In such systems the memory is arranged into banks that have
125 constructs an independent memory management subsystem. A node has its
127 counters. You can find more details about NUMA in
128 :ref:`Documentation/vm/numa.rst <numa>` and in
129 :ref:`Documentation/admin-guide/mm/numa_memory_policy.rst <numa_memory_policy>`.
134 The physical memory is volatile and the common case for getting data
135 into the memory is to read it from files. Whenever a file is read, the
138 is placed in the page cache and eventually gets into the backing
143 Anonymous Memory
146 The `anonymous memory` or `anonymous mappings` represent memory that
149 call. Usually, the anonymous mappings only define virtual memory areas
151 in creation of a page table entry that references a special physical
163 memory allocated by user space processes etc.
166 memory management. The pages that can be freed at any time, either
170 reclaimable pages are page cache and anonymous memory.
172 In most cases, the pages holding internal kernel data and used as DMA
174 their user. Such pages are called `unreclaimable`. However, in certain
176 reclaimed. For instance, in-memory caches of filesystem metadata can
177 be re-read from the storage device and therefore it is possible to
178 discard them from the main memory when system is under memory
181 The process of freeing the reclaimable physical memory pages and
184 of the system. When the system is not loaded, most of the memory is free
189 asynchronously scan memory pages and either just free them if the data
191 device (remember those dirty pages?). As memory usage increases even
192 more and reaches another threshold - min watermark - an allocation
193 will trigger `direct reclaim`. In this case allocation is stalled
194 until enough memory pages are reclaimed to satisfy the request.
199 As the system runs, tasks allocate and free the memory and it becomes
200 fragmented. Although with virtual memory it is possible to present
202 necessary to allocate large physically contiguous memory areas. Such
204 buffer for DMA, or when THP allocates a huge page. Memory `compaction`
206 from the lower part of a memory zone to free pages in the upper part
211 Like reclaim, the compaction may happen asynchronously in the ``kcompactd``
212 daemon or synchronously as a result of a memory allocation request.
217 It is possible that on a loaded machine memory will be exhausted and the
218 kernel will be unable to reclaim enough memory to continue to operate. In
222 system health. The selected task is killed in a hope that after it exits
223 enough memory will be freed to continue normal operation.