~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/Documentation/admin-guide/mm/multigen_lru.rst

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /Documentation/admin-guide/mm/multigen_lru.rst (Version linux-6.12-rc7) and /Documentation/admin-guide/mm/multigen_lru.rst (Version linux-4.10.17)


  1 .. SPDX-License-Identifier: GPL-2.0               
  2                                                   
  3 =============                                     
  4 Multi-Gen LRU                                     
  5 =============                                     
  6 The multi-gen LRU is an alternative LRU implem    
  7 page reclaim and improves performance under me    
  8 reclaim decides the kernel's caching policy an    
  9 memory. It directly impacts the kswapd CPU usa    
 10                                                   
 11 Quick start                                       
 12 ===========                                       
 13 Build the kernel with the following configurat    
 14                                                   
 15 * ``CONFIG_LRU_GEN=y``                            
 16 * ``CONFIG_LRU_GEN_ENABLED=y``                    
 17                                                   
 18 All set!                                          
 19                                                   
 20 Runtime options                                   
 21 ===============                                   
 22 ``/sys/kernel/mm/lru_gen/`` contains stable AB    
 23 following subsections.                            
 24                                                   
 25 Kill switch                                       
 26 -----------                                       
 27 ``enabled`` accepts different values to enable    
 28 following components. Its default value depend    
 29 ``CONFIG_LRU_GEN_ENABLED``. All the components    
 30 unless some of them have unforeseen side effec    
 31 ``enabled`` has no effect when a component is     
 32 hardware, and valid values will be accepted ev    
 33 is off.                                           
 34                                                   
 35 ====== =======================================    
 36 Values Components                                 
 37 ====== =======================================    
 38 0x0001 The main switch for the multi-gen LRU.     
 39 0x0002 Clearing the accessed bit in leaf page     
 40        batches, when MMU sets it (e.g., on x86    
 41        theoretically worsen lock contention (m    
 42        disabled, the multi-gen LRU will suffer    
 43        degradation for workloads that contiguo    
 44        whose accessed bits can be otherwise cl    
 45        batches.                                   
 46 0x0004 Clearing the accessed bit in non-leaf p    
 47        well, when MMU sets it (e.g., on x86).     
 48        verified on x86 varieties other than In    
 49        disabled, the multi-gen LRU will suffer    
 50        performance degradation.                   
 51 [yYnN] Apply to all the components above.         
 52 ====== =======================================    
 53                                                   
 54 E.g.,                                             
 55 ::                                                
 56                                                   
 57     echo y >/sys/kernel/mm/lru_gen/enabled        
 58     cat /sys/kernel/mm/lru_gen/enabled            
 59     0x0007                                        
 60     echo 5 >/sys/kernel/mm/lru_gen/enabled        
 61     cat /sys/kernel/mm/lru_gen/enabled            
 62     0x0005                                        
 63                                                   
 64 Thrashing prevention                              
 65 --------------------                              
 66 Personal computers are more sensitive to thras    
 67 cause janks (lags when rendering UI) and negat    
 68 experience. The multi-gen LRU offers thrashing    
 69 majority of laptop and desktop users who do no    
 70                                                   
 71 Users can write ``N`` to ``min_ttl_ms`` to pre    
 72 ``N`` milliseconds from getting evicted. The O    
 73 if this working set cannot be kept in memory.     
 74 option works as an adjustable pressure relief     
 75 terminates applications that are hopefully not    
 76                                                   
 77 Based on the average human detectable lag (~10    
 78 eliminates intolerable janks due to thrashing.    
 79 ``N=3000`` make janks less noticeable at the r    
 80 kills.                                            
 81                                                   
 82 The default value ``0`` means disabled.           
 83                                                   
 84 Experimental features                             
 85 =====================                             
 86 ``/sys/kernel/debug/lru_gen`` accepts commands    
 87 following subsections. Multiple command lines     
 88 concatenation with delimiters ``,`` and ``;``.    
 89                                                   
 90 ``/sys/kernel/debug/lru_gen_full`` provides ad    
 91 debugging. ``CONFIG_LRU_GEN_STATS=y`` keeps hi    
 92 evicted generations in this file.                 
 93                                                   
 94 Working set estimation                            
 95 ----------------------                            
 96 Working set estimation measures how much memor    
 97 in a given time interval, and it is usually do    
 98 the performance of the application. E.g., data    
 99 optimize job scheduling (bin packing) to impro    
100 When a new job comes in, the job scheduler nee    
101 each server it manages can allocate a certain     
102 this new job before it can pick a candidate. T    
103 scheduler needs to estimate the working sets o    
104                                                   
105 When it is read, ``lru_gen`` returns a histogr    
106 accessed over different time intervals for eac    
107 ``MAX_NR_GENS`` decides the number of bins for    
108 histograms are noncumulative.                     
109 ::                                                
110                                                   
111     memcg  memcg_id  memcg_path                   
112        node  node_id                              
113            min_gen_nr  age_in_ms  nr_anon_page    
114            ...                                    
115            max_gen_nr  age_in_ms  nr_anon_page    
116                                                   
117 Each bin contains an estimated number of pages    
118 within ``age_in_ms``. E.g., ``min_gen_nr`` con    
119 and ``max_gen_nr`` contains the hottest pages,    
120 the former is the largest and that of the latt    
121                                                   
122 Users can write the following command to ``lru    
123 generation ``max_gen_nr+1``:                      
124                                                   
125     ``+ memcg_id node_id max_gen_nr [can_swap     
126                                                   
127 ``can_swap`` defaults to the swap setting and,    
128 it forces the scan of anon pages when swap is     
129 ``force_scan`` defaults to ``1`` and, if it is    
130 employs heuristics to reduce the overhead, whi    
131 the coverage as well.                             
132                                                   
133 A typical use case is that a job scheduler run    
134 certain time interval to create new generation    
135 servers it manages based on the sizes of their    
136 this time interval.                               
137                                                   
138 Proactive reclaim                                 
139 -----------------                                 
140 Proactive reclaim induces page reclaim when th    
141 pressure. It usually targets cold pages only.     
142 comes in, the job scheduler wants to proactive    
143 the server it selected, to improve the chance     
144 this new job.                                     
145                                                   
146 Users can write the following command to ``lru    
147 generations less than or equal to ``min_gen_nr    
148                                                   
149     ``- memcg_id node_id min_gen_nr [swappines    
150                                                   
151 ``min_gen_nr`` should be less than ``max_gen_n    
152 ``max_gen_nr`` and ``max_gen_nr-1`` are not fu    
153 the active list) and therefore cannot be evict    
154 overrides the default value in ``/proc/sys/vm/    
155 ``nr_to_reclaim`` limits the number of pages t    
156                                                   
157 A typical use case is that a job scheduler run    
158 tries to land a new job on a server. If it fai    
159 cold pages because of the overestimation, it r    
160 server according to the ranking result obtaine    
161 estimation step. This less forceful approach l    
162 existing jobs.                                    
                                                      

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php