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

TOMOYO Linux Cross Reference
Linux/Documentation/admin-guide/mm/nommu-mmap.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/nommu-mmap.rst (Version linux-6.12-rc7) and /Documentation/admin-guide/mm/nommu-mmap.rst (Version linux-4.12.14)


  1 =============================                     
  2 No-MMU memory mapping support                     
  3 =============================                     
  4                                                   
  5 The kernel has limited support for memory mapp    
  6 as are used in uClinux environments. From the     
  7 mapping is made use of in conjunction with the    
  8 call and the execve() system call. From the ke    
  9 mapping is actually performed by the binfmt dr    
 10 mmap() routines to do the actual work.            
 11                                                   
 12 Memory mapping behaviour also involves the way    
 13 ptrace() work. Under uClinux there is no fork(    
 14 the CLONE_VM flag.                                
 15                                                   
 16 The behaviour is similar between the MMU and n    
 17 and it's also much more restricted in the latt    
 18                                                   
 19  (#) Anonymous mapping, MAP_PRIVATE               
 20                                                   
 21         In the MMU case: VM regions backed by     
 22         across fork.                              
 23                                                   
 24         In the no-MMU case: VM regions backed     
 25         pages.                                    
 26                                                   
 27  (#) Anonymous mapping, MAP_SHARED                
 28                                                   
 29         These behave very much like private ma    
 30         shared across fork() or clone() withou    
 31         the no-MMU case doesn't support these,    
 32         MAP_PRIVATE there.                        
 33                                                   
 34  (#) File, MAP_PRIVATE, PROT_READ / PROT_EXEC,    
 35                                                   
 36         In the MMU case: VM regions backed by     
 37         the underlying file are reflected in t    
 38                                                   
 39         In the no-MMU case:                       
 40                                                   
 41          - If one exists, the kernel will re-u    
 42            same segment of the same file if th    
 43            even if this was created by another    
 44                                                   
 45          - If possible, the file mapping will     
 46            if the backing device has the NOMMU    
 47            appropriate mapping protection capa    
 48            and mtd might all permit this.         
 49                                                   
 50          - If the backing device can't or won'    
 51            but does have the NOMMU_MAP_COPY ca    
 52            appropriate bit of the file will be    
 53            memory and any extraneous space bey    
 54                                                   
 55          - Writes to the file do not affect th    
 56            are visible in other processes (no     
 57            happen.                                
 58                                                   
 59  (#) File, MAP_PRIVATE, PROT_READ / PROT_EXEC,    
 60                                                   
 61         In the MMU case: like the non-PROT_WRI    
 62         question get copied before the write a    
 63         on writes to the file underneath that     
 64         the mapping's backing pages. The page     
 65                                                   
 66         In the no-MMU case: works much like th    
 67         that a copy is always taken and never     
 68                                                   
 69  (#) Regular file / blockdev, MAP_SHARED, PROT    
 70                                                   
 71         In the MMU case: VM regions backed by     
 72         pages written back to file; writes to     
 73         mapping; shared across fork.              
 74                                                   
 75         In the no-MMU case: not supported.        
 76                                                   
 77  (#) Memory backed regular file, MAP_SHARED, P    
 78                                                   
 79         In the MMU case: As for ordinary regul    
 80                                                   
 81         In the no-MMU case: The filesystem pro    
 82         (such as ramfs or tmpfs) may choose to    
 83         sequence by providing a contiguous seq    
 84         case, a shared-writable memory mapping    
 85         as for the MMU case. If the filesystem    
 86         support, then the mapping request will    
 87                                                   
 88  (#) Memory backed blockdev, MAP_SHARED, PROT_    
 89                                                   
 90         In the MMU case: As for ordinary regul    
 91                                                   
 92         In the no-MMU case: As for memory back    
 93         blockdev must be able to provide a con    
 94         truncate being called. The ramdisk dri    
 95         all its memory as a contiguous array u    
 96                                                   
 97  (#) Memory backed chardev, MAP_SHARED, PROT_R    
 98                                                   
 99         In the MMU case: As for ordinary regul    
100                                                   
101         In the no-MMU case: The character devi    
102         the mmap() by providing direct access     
103         provides memory or quasi-memory that c    
104         of such are frame buffers and flash de    
105         provide any such support, then the map    
106                                                   
107                                                   
108 Further notes on no-MMU MMAP                      
109 ============================                      
110                                                   
111  (#) A request for a private mapping of a file    
112      page-aligned.  This is because XIP may ta    
113      paged aligned in the backing store.          
114                                                   
115  (#) A request for an anonymous mapping will a    
116      possible the size of the request should b    
117      of the space may be wasted as the kernel     
118      granule but will only discard the excess     
119      this has an effect on fragmentation.         
120                                                   
121  (#) The memory allocated by a request for an     
122      be cleared by the kernel before being ret    
123      Linux man pages (ver 2.22 or later).         
124                                                   
125      In the MMU case this can be achieved with    
126      regions are backed by virtual pages, with    
127      to cleared physical pages when a write ha    
128      (prior to which, the pages are effectivel    
129      from which reads can take place).  This s    
130      initialize the contents of a page - depen    
131      mapping.                                     
132                                                   
133      In the no-MMU case, however, anonymous ma    
134      pages, and the entire map is cleared at a    
135      significant delays during a userspace mal    
136      anonymous mapping and the kernel then doe    
137                                                   
138      However, for memory that isn't required t    
139      returned by malloc() - mmap() can take a     
140      indicate to the kernel that it shouldn't     
141      returning it.  Note that CONFIG_MMAP_ALLO    
142      to permit this, otherwise the flag will b    
143                                                   
144      uClibc uses this to speed up malloc(), an    
145      to allocate the brk and stack region.        
146                                                   
147  (#) A list of all the private copy and anonym    
148      visible through /proc/maps in no-MMU mode    
149                                                   
150  (#) A list of all the mappings in use by a pr    
151      /proc/<pid>/maps in no-MMU mode.             
152                                                   
153  (#) Supplying MAP_FIXED or a requesting a par    
154      result in an error.                          
155                                                   
156  (#) Files mapped privately usually have to ha    
157      driver or filesystem so that the contents    
158      allocated if mmap() chooses not to map th    
159      error will result if they don't. This is     
160      with character device files, pipes, fifos    
161                                                   
162                                                   
163 Interprocess shared memory                        
164 ==========================                        
165                                                   
166 Both SYSV IPC SHM shared memory and POSIX shar    
167 mode.  The former through the usual mechanism,    
168 on ramfs or tmpfs mounts.                         
169                                                   
170                                                   
171 Futexes                                           
172 =======                                           
173                                                   
174 Futexes are supported in NOMMU mode if the arc    
175 be given if an address passed to the futex sys    
176 mappings made by a process or if the mapping i    
177 support futexes (such as an I/O chardev mappin    
178                                                   
179                                                   
180 No-MMU mremap                                     
181 =============                                     
182                                                   
183 The mremap() function is partially supported.     
184 mapping, and may move it [#]_ if MREMAP_MAYMOV    
185 of the mapping exceeds the size of the slab ob    
186 memory to which the mapping refers, or if a sm    
187                                                   
188 MREMAP_FIXED is not supported, though it is ig    
189 address and the object does not need to be mov    
190                                                   
191 Shared mappings may not be moved.  Shareable m    
192 even if they are not currently shared.            
193                                                   
194 The mremap() function must be given an exact m    
195 a previously mapped object.  It may not be use    
196 mappings, move parts of existing mappings or r    
197 act on a complete mapping.                        
198                                                   
199 .. [#] Not currently supported.                   
200                                                   
201                                                   
202 Providing shareable character device support      
203 ============================================      
204                                                   
205 To provide shareable character device support,    
206 file->f_op->get_unmapped_area() operation. The    
207 to get a proposed address for the mapping. Thi    
208 doesn't wish to honour the mapping because it'    
209 under some unsupported combination of flags or    
210                                                   
211 The driver should also provide backing device     
212 to indicate the permitted types of mapping on     
213 assumed to be readable and writable, not execu    
214 directly (can't be copied).                       
215                                                   
216 The file->f_op->mmap() operation will be calle    
217 mapping. It can be rejected at that point. Ret    
218 cause the mapping to be copied instead if NOMM    
219                                                   
220 The vm_ops->close() routine will be invoked wh    
221 is removed. An existing mapping will be shared    
222 without notifying the driver.                     
223                                                   
224 It is permitted also for the file->f_op->get_u    
225 return -ENOSYS. This will be taken to mean tha    
226 want to handle it, despite the fact it's got a    
227 might try directing the call to a secondary dr    
228 implement it. Such is the case for the framebu    
229 direct the call to the device-specific driver.    
230 mapping request will be rejected if NOMMU_MAP_    
231 copy mapped otherwise.                            
232                                                   
233 .. important::                                    
234                                                   
235         Some types of device may present a dif    
236         looking at them in certain modes. Flas    
237         instance if they're in programming or     
238         status reflected in the mapping, inste    
239                                                   
240         In such a case, care must be taken les    
241         private mapping showing such informati    
242         controlling the device. Remember espec    
243         mappings may still be mapped directly     
244         circumstances!                            
245                                                   
246                                                   
247 Providing shareable memory-backed file support    
248 ==============================================    
249                                                   
250 Provision of shared mappings on memory backed     
251 of support for shared mapped character devices    
252 filesystem providing the service will probably    
253 of pages and permit mappings to be made on tha    
254                                                   
255 It is recommended that a truncate operation ap    
256 increases the file size, if that file is empty    
257 enough pages to honour a mapping. This is requ    
258 memory.                                           
259                                                   
260 Memory backed devices are indicated by the map    
261 the memory_backed flag set.                       
262                                                   
263                                                   
264 Providing shareable block device support          
265 ========================================          
266                                                   
267 Provision of shared mappings on block device f    
268 character devices. If there isn't a real devic    
269 should allocate sufficient contiguous memory t    
270                                                   
271                                                   
272 Adjusting page trimming behaviour                 
273 =================================                 
274                                                   
275 NOMMU mmap automatically rounds up to the near    
276 when performing an allocation.  This can have     
277 fragmentation, and as such, is left configurab    
278 aggressively trim allocations and discard any     
279 allocator.  In order to retain finer-grained c    
280 behaviour can either be disabled completely, o    
281 watermark where trimming begins.                  
282                                                   
283 Page trimming behaviour is configurable via th    
                                                      

~ [ 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