Serge E. Hallyn wrote: > Quoting Oren Laadan (orenl@xxxxxxxxxxxxxxx): >> The task address space (task->mm) may be shared between processes if >> CLONE_VM is used, and particularly among threads. Accordingly, treat >> 'task->mm' as a shared object: during checkpoint check against the >> objhash and only dump the contents if seen for the first time. During >> restart, likewise, only restore if it's a new instance, otherwise use >> the one already registered in the objhash. >> >> Signed-off-by: Oren Laadan <orenl@xxxxxxxxxxxxxxx> > > Cool. > > Acked-by: Serge Hallyn <serue@xxxxxxxxxx> > > Although: > >> + /* if the mm's objref is in the objhash, use that instance */ >> + mm = cr_obj_get_by_ref(ctx, hh->objref, CR_OBJ_MM); >> + if (IS_ERR(mm)) { >> + ret = PTR_ERR(mm); >> + goto out; >> + } >> >> + if (mm) { >> + if (mm != current->mm) { > > In what twisted world could mm == current->mm at restart? Tasks are re-created in user space, and so are threads. So threads will already have their 'mm' set correctly. Oren. > >> + ret = exec_mmap(mm); >> + if (ret < 0) >> + goto out; >> + atomic_inc(&mm->mm_users); >> + } >> + ret = 0; >> + goto out; >> + } >> + >> + /* otherwise, add our mm to the objhash for future generations */ >> mm = current->mm; >> + ret = cr_obj_add_ref(ctx, mm, hh->objref, CR_OBJ_MM, 0); >> + if (ret < 0) >> + goto out; >> >> /* point of no return -- destruct current mm */ >> down_write(&mm->mmap_sem); >> diff --git a/include/linux/checkpoint.h b/include/linux/checkpoint.h >> index 043535c..1bfe284 100644 >> --- a/include/linux/checkpoint.h >> +++ b/include/linux/checkpoint.h >> @@ -77,6 +77,7 @@ extern void cr_ctx_put(struct cr_ctx *ctx); >> enum { >> CR_OBJ_FILE = 1, >> CR_OBJ_INODE, >> + CR_OBJ_MM, >> CR_OBJ_MAX >> }; >> >> -- >> 1.5.4.3 > _______________________________________________ Containers mailing list Containers@xxxxxxxxxxxxxxxxxxxxxxxxxx https://lists.linux-foundation.org/mailman/listinfo/containers