-
Pavel Tikhomirov authored
We have a problem when a pid is reused between consequent dumps we can't understand if pagemap and pages from images of parent dump are invalid to restore these pid already. That can lead even to wrong memory restored for these pid, see the test in last patch. So these is a try do separate processes with (likely) invalid previous memory dump from processes with 100% valid previous dump. For that we use the value of /proc/<pid>/stat's start_time and also the timestamp of each (pre)dump. If the start time is strictly less than the timestamp, that means that the pagemap for these pid from previous dump is valid - was done for exactly the same process. Creation time is in centiseconds by default so if predump is really fast (<1csec) we can have false negative decisions for some processes, but in case of long running processes we are fine. https://jira.sw.ru/browse/PSBM-67502 v2: remove __maybe_unused for get_parent_stats; fix get_parent_stats to have static typing; print warning only if unsure; check has_dump_uptime v3: read parent stats from image only once; reuse stat from previous parse_pid_stat call on dump v4: move code to function; use unsigned long long for ticks; put proc_pid_stat on mem_dump_ctl; print warning on all pid-reuse cases v5: free parent's stats entry properly, pass it in arguments to (pre_)dump_one_task v6: free parent's stats in error path too v7: zero init parent_se v8: improve error message v9: switch to inventory image from stats, if pid-reuse fails - fail current dump Signed-off-by:
Pavel Tikhomirov <ptikhomirov@virtuozzo.com> Signed-off-by:
Andrei Vagin <avagin@virtuozzo.com>
6fb00f55