[Devel] Re: [RFC v14-rc3][PATCH 33/36] Support for share memory address spaces

Oren Laadan orenl at cs.columbia.edu
Thu Apr 9 15:13:11 PDT 2009



Serge E. Hallyn wrote:
> Quoting Oren Laadan (orenl at cs.columbia.edu):
>> 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 at cs.columbia.edu>
> 
> Cool.
> 
> Acked-by: Serge Hallyn <serue at us.ibm.com>
> 
> 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 at lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers




More information about the Devel mailing list