Do not remap vmas when not needed

Submitted by Pavel Emelianov on May 5, 2017, 4:01 p.m.


Reviewer None
Submitted May 5, 2017, 4:01 p.m.
Last Updated May 11, 2017, 8:42 p.m.
Revision 2

Cover Letter


My recent experiment with restore performance showed that we spend too much
time remapping vmas that have been previously mapped into premap area. The
total remap time is on the top-2 list (the slowest time was pread restoring
7M of memory).

However, premapping vmas is only needed when we have several tasks and need
to cow pages. In all other cases memory can be tried to restored in-place.

This patch does so (sometimes).

v2: Fixed bugs found by travis run.

-- Pavel