[CRIU] [PATCH] Attempt to restore cgroups

Pavel Emelyanov xemul at parallels.com
Thu Jul 3 01:06:30 PDT 2014


On 07/02/2014 10:45 PM, Tycho Andersen wrote:
> Hi Pavel,
> 
> On Wed, Jul 02, 2014 at 12:12:10AM +0400, Pavel Emelyanov wrote:
>>> +{
>>> +	struct cgroup_dir *cur;
>>> +	CgroupDirEntry *cde;
>>> +	void *m;
>>> +	int i = 0;
>>> +
>>> +	m = xmalloc(n_dirs * (sizeof(CgroupDirEntry *) + sizeof(CgroupDirEntry)));
>>> +	*ents = m;
>>> +	if (!m)
>>> +		return -1;
>>> +
>>> +	cde = m + n_dirs * sizeof(CgroupDirEntry *);
>>
>> Just for the record -- we have the xptr_pull() helper that can help putting
>> objects one-by-one in the single-malloc-ed memory segment. You can find the
>> good (I hope)  example of it in the core_entry_alloc().
> 
> So after playing with this for a bit it isn't entirely clear how I can
> condense the code using xptr_pull. The implementation above is one I
> copied from dump_sets(), which has the same protobuf type problem.

I don't insist on using the xptr_pull() :) I just pointed one out, if you
find it inappropriate for your code it's OK.

> I have the rest of the changes suggested in this thread prepared, 
> so I can post those or if you can clarify xptr_pull, I can make this 
> change as well.

Cool! Looking forward to the patch series :)

Thanks,
Pavel



More information about the CRIU mailing list