So, memory is restored here for the reasons described above. Note, that here CRIU does two things only
+
+
# Move anonymous VMAs to proper places
+
# Map new file VMAs
+
+
The anonymous memory is mmaped and filled with data earlier, in restorer it's only mremap()-ed into proper addressed. The files mapping are just mmap()-ed, as data in them sits in files :)
+
+
Timers are restore here, since CRIU processes can wait for each other for some time while restoring and not to lose timer ticks there, we delay timers arming this the last moment.
+
+
Credentials are restored here to allow CRIU perform privileged operations such as fork-with-pid or chroot().
+
+
Threads are restored here for simplicity. If we restored them before, we'd have to "park" them while we change the memory layout. Instead of doing this, we first toss the memory arond, then create threads.