Signed-off-by: Matt Helsley <matthltc@xxxxxxxxxx> --- checkpoint/objhash.c | 27 --------------------------- mm/mmap.c | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 27 deletions(-) diff --git a/checkpoint/objhash.c b/checkpoint/objhash.c index e2c2ce3..ce89066 100644 --- a/checkpoint/objhash.c +++ b/checkpoint/objhash.c @@ -89,22 +89,6 @@ static int obj_file_users(void *ptr) return atomic_long_read(&((struct file *) ptr)->f_count); } -static int obj_mm_grab(void *ptr) -{ - atomic_inc(&((struct mm_struct *) ptr)->mm_users); - return 0; -} - -static void obj_mm_drop(void *ptr, int lastref) -{ - mmput((struct mm_struct *) ptr); -} - -static int obj_mm_users(void *ptr) -{ - return atomic_read(&((struct mm_struct *) ptr)->mm_users); -} - static int obj_fs_grab(void *ptr) { get_fs_struct((struct fs_struct *) ptr); @@ -352,16 +336,6 @@ static const struct ckpt_obj_ops ckpt_obj_file_ops = { .checkpoint = checkpoint_file, .restore = restore_file, }; -/* mm object */ -static const struct ckpt_obj_ops ckpt_obj_mm_ops = { - .obj_name = "MM", - .obj_type = CKPT_OBJ_MM, - .ref_drop = obj_mm_drop, - .ref_grab = obj_mm_grab, - .ref_users = obj_mm_users, - .checkpoint = checkpoint_mm, - .restore = restore_mm, -}; /* fs object */ static const struct ckpt_obj_ops ckpt_obj_fs_ops = { .obj_name = "FS", @@ -506,7 +480,6 @@ static const struct ckpt_obj_ops *ckpt_obj_ops[] = { [CKPT_OBJ_INODE] = &ckpt_obj_inode_ops, [CKPT_OBJ_FILE_TABLE] = &ckpt_obj_files_struct_ops, [CKPT_OBJ_FILE] = &ckpt_obj_file_ops, - [CKPT_OBJ_MM] = &ckpt_obj_mm_ops, [CKPT_OBJ_FS] = &ckpt_obj_fs_ops, [CKPT_OBJ_SIGHAND] = &ckpt_obj_sighand_ops, [CKPT_OBJ_SIGNAL] = &ckpt_obj_signal_ops, diff --git a/mm/mmap.c b/mm/mmap.c index 6aa606a..b19a754 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -2623,6 +2623,43 @@ void mm_drop_all_locks(struct mm_struct *mm) mutex_unlock(&mm_all_locks_mutex); } +#ifdef CONFIG_CHECKPOINT +static int obj_mm_grab(void *ptr) +{ + atomic_inc(&((struct mm_struct *) ptr)->mm_users); + return 0; +} + +static void obj_mm_drop(void *ptr, int lastref) +{ + mmput((struct mm_struct *) ptr); +} + +static int obj_mm_users(void *ptr) +{ + return atomic_read(&((struct mm_struct *) ptr)->mm_users); +} + +/* mm object */ +static const struct ckpt_obj_ops ckpt_obj_mm_ops = { + .obj_name = "MM", + .obj_type = CKPT_OBJ_MM, + .ref_drop = obj_mm_drop, + .ref_grab = obj_mm_grab, + .ref_users = obj_mm_users, + .checkpoint = checkpoint_mm, + .restore = restore_mm, +}; + +static inline void register_mmap_checkpoint(void) +{ + register_checkpoint_obj(&ckpt_obj_mm_ops); +} +#else +static inline void register_mmap_checkpoint(void) +{} +#endif + /* * initialise the VMA slab */ @@ -2630,6 +2667,7 @@ void __init mmap_init(void) { int ret; + register_mmap_checkpoint(); ret = percpu_counter_init(&vm_committed_as, 0); VM_BUG_ON(ret); } -- 1.6.3.3 _______________________________________________ Containers mailing list Containers@xxxxxxxxxxxxxxxxxxxxxxxxxx https://lists.linux-foundation.org/mailman/listinfo/containers