Line 5: |
Line 5: |
| | | |
| Every process has one or more so called mmapings -- regions of virtual memory which it's allowed to use. Some mappings can be shared between a few processes. | | Every process has one or more so called mmapings -- regions of virtual memory which it's allowed to use. Some mappings can be shared between a few processes. |
− | During the checkpointing, CRIU need to figure out all the shared mappings in order to dump them as such. | + | During the checkpointing, CRIU needs to figure out all the shared mappings in order to dump them as such. |
| | | |
− | It does so by performing <code>fstatat()</code> for each entry in <code>/proc/$PID/map_files/</code>, | + | It does so by calling <code>fstatat()</code> on each entry found in the <code>/proc/$PID/map_files/</code>, |
− | noting the ''device'' and ''inode'' fields of the structure returned by fstatat(). This information | + | noting the ''device:inode'' pair of the structure returned by fstatat(). Now, if some processes have a |
− | is collected and sorted. Now, if any few processes have a mapping with same ''device'' and ''inode'',
| + | mapping with the same ''device:inode'' pair, this mapping is marked as shared between them and is dumped as such. |
− | this mapping is a shared one and should be dumped as such. | + | |
| + | Dumping a mapping means writing an entry into proceess' mm.img file and storing its contents. For shared |
| + | mapping the contents is stored into pagemap-shmem.img and pages.img pair of images (see [[Memory dumps]]). |
| | | |
| It's important to note that the above mechanism works not just for the file-based mappings, | | It's important to note that the above mechanism works not just for the file-based mappings, |