Lines Matching refs:the
6 as are used in uClinux environments. From the userspace point of view, memory
7 mapping is made use of in conjunction with the mmap() system call, the shmat()
8 call and the execve() system call. From the kernel's point of view, execve()
9 mapping is actually performed by the binfmt drivers, which call back into the
10 mmap() routines to do the actual work.
12 Memory mapping behaviour also involves the way fork(), vfork(), clone() and
14 the CLONE_VM flag.
16 The behaviour is similar between the MMU and no-MMU cases, but not identical;
17 and it's also much more restricted in the latter case:
21 In the MMU case: VM regions backed by arbitrary pages; copy-on-write
24 In the no-MMU case: VM regions backed by arbitrary contiguous runs of
30 shared across fork() or clone() without CLONE_VM in the MMU case. Since
31 the no-MMU case doesn't support these, behaviour is identical to
36 In the MMU case: VM regions backed by pages read from file; changes to
37 the underlying file are reflected in the mapping; copied across fork.
39 In the no-MMU case:
41 - If one exists, the kernel will re-use an existing mapping to the
42 same segment of the same file if that has compatible permissions,
45 - If possible, the file mapping will be directly on the backing device
46 if the backing device has the NOMMU_MAP_DIRECT capability and
50 - If the backing device device can't or won't permit direct sharing,
51 but does have the NOMMU_MAP_COPY capability, then a copy of the
52 appropriate bit of the file will be read into a contiguous bit of
53 memory and any extraneous space beyond the EOF will be cleared
55 - Writes to the file do not affect the mapping; writes to the mapping
61 In the MMU case: like the non-PROT_WRITE case, except that the pages in
62 question get copied before the write actually happens. From that point
63 on writes to the file underneath that page no longer get reflected into
64 the mapping's backing pages. The page is then backed by swap instead.
66 In the no-MMU case: works much like the non-PROT_WRITE case, except
71 In the MMU case: VM regions backed by pages read from file; changes to
75 In the no-MMU case: not supported.
79 In the MMU case: As for ordinary regular files.
81 In the no-MMU case: The filesystem providing the memory-backed file
85 as for the MMU case. If the filesystem does not provide any such
86 support, then the mapping request will be denied.
90 In the MMU case: As for ordinary regular files.
92 In the no-MMU case: As for memory backed regular files, but the
99 In the MMU case: As for ordinary regular files.
101 In the no-MMU case: The character device driver may choose to honour
102 the mmap() by providing direct access to the underlying device if it
104 of such are frame buffers and flash devices. If the driver does not
105 provide any such support, then the mapping request will be denied.
113 page-aligned. This is because XIP may take place, and the data may not be
114 paged aligned in the backing store.
117 possible the size of the request should be a power of two otherwise some
118 of the space may be wasted as the kernel must allocate a power-of-2
119 granule but will only discard the excess if appropriately configured as
123 be cleared by the kernel before being returned in accordance with the
126 In the MMU case this can be achieved with reasonable performance as
127 regions are backed by virtual pages, with the contents only being mapped
129 (prior to which, the pages are effectively mapped to the global zero page
130 from which reads can take place). This spreads out the time it takes to
131 initialize the contents of a page - depending on the write-usage of the
134 In the no-MMU case, however, anonymous mappings are backed by physical
135 pages, and the entire map is cleared at allocation time. This can cause
136 significant delays during a userspace malloc() as the C library does an
137 anonymous mapping and the kernel then does a memset for the entire map.
141 indicate to the kernel that it shouldn't bother clearing the memory before
143 to permit this, otherwise the flag will be ignored.
145 uClibc uses this to speed up malloc(), and the ELF-FDPIC binfmt uses this
146 to allocate the brk and stack region.
148 (*) A list of all the private copy and anonymous mappings on the system is
151 (*) A list of all the mappings in use by a process is visible through
157 (*) Files mapped privately usually have to have a read method provided by the
158 driver or filesystem so that the contents can be read into the memory
159 allocated if mmap() chooses not to map the backing device directly. An
169 mode. The former through the usual mechanism, the latter through files created
177 Futexes are supported in NOMMU mode if the arch supports them. An error will
178 be given if an address passed to the futex system call lies outside the
179 mappings made by a process or if the mapping in which the address lies does not
187 The mremap() function is partially supported. It may change the size of a
188 mapping, and may move it[*] if MREMAP_MAYMOVE is specified and if the new size
189 of the mapping exceeds the size of the slab object currently occupied by the
190 memory to which the mapping refers, or if a smaller slab object could be used.
193 address and the object does not need to be moved.
212 to get a proposed address for the mapping. This may return an error if it
213 doesn't wish to honour the mapping because it's too long, at a weird offset,
217 to indicate the permitted types of mapping on such devices. The default is
221 The file->f_op->mmap() operation will be called to actually inaugurate the
222 mapping. It can be rejected at that point. Returning the ENOSYS error will
223 cause the mapping to be copied instead if NOMMU_MAP_COPY is specified.
225 The vm_ops->close() routine will be invoked when the last mapping on a chardev
227 without notifying the driver.
229 It is permitted also for the file->f_op->get_unmapped_area() operation to
231 want to handle it, despite the fact it's got an operation. For instance, it
232 might try directing the call to a secondary driver which turns out not to
233 implement it. Such is the case for the framebuffer driver which attempts to
234 direct the call to the device-specific driver. Under such circumstances, the
242 instance if they're in programming or erase mode, you might see the
243 status reflected in the mapping, instead of the data.
246 private mapping showing such information when the driver is busy
247 controlling the device. Remember especially: private executable
248 mappings may still be mapped directly off the device under some
256 Provision of shared mappings on memory backed files is similar to the provision
257 of support for shared mapped character devices. The main difference is that the
258 filesystem providing the service will probably allocate a contiguous collection
262 increases the file size, if that file is empty, be taken as a request to gather
266 Memory backed devices are indicated by the mapping's backing device info having
267 the memory_backed flag set.
274 Provision of shared mappings on block device files is exactly the same as for
275 character devices. If there isn't a real device underneath, then the driver
283 NOMMU mmap automatically rounds up to the nearest power-of-2 number of pages
286 aggressively trim allocations and discard any excess pages back in to the page
291 Page trimming behaviour is configurable via the sysctl `vm.nr_trim_pages'.