diff --git a/criu/cr-restore.c b/criu/cr-restore.c index d5b6c8037a..83e7ce9157 100644 --- a/criu/cr-restore.c +++ b/criu/cr-restore.c @@ -116,6 +116,7 @@ #endif struct pstree_item *current; +static bool disable_background_lazy_page_fetch; static int restore_task_with_children(void *); static int sigreturn_restore(pid_t pid, struct task_restore_args *ta, unsigned long alen, CoreEntry *core); @@ -2213,7 +2214,7 @@ static int restore_root_task(struct pstree_item *init) goto out_kill_network_unlocked; } - if (lazy_pages_finish_restore()) + if (!disable_background_lazy_page_fetch && lazy_pages_finish_restore()) goto out_kill_network_unlocked; __restore_switch_stage(CR_STATE_COMPLETE); @@ -3499,3 +3500,8 @@ static int sigreturn_restore(pid_t pid, struct task_restore_args *task_args, uns exit(1); return -1; } + +static void __attribute__((constructor)) pagemap_cache_init(void) +{ + disable_background_lazy_page_fetch = (getenv("CRIU_DISABLE_BACKGROUND_LAZY_PAGE_FETCH") != NULL); +}