[CRIU] Re: [PATCH cr 1/2] crtools: link pstree_item-s in a tree (v2)

Pavel Emelyanov xemul at parallels.com
Thu May 31 06:56:58 EDT 2012


On 05/30/2012 05:53 PM, Andrew Vagin wrote:
> 
>>> @@ -180,16 +179,18 @@ struct pstree_item {
>>>  	struct list_head	list;
>>
>> You put them in a tree and iterate this tree. Thus, why do we need a
>> separate plain list?
> 
> children is a list head, list is a list entry.
> 
> list_add(&pi1->list, &pi2->children)

I see. Then rename the list to siblings.

>>
>>>  	pid_t			pid;		/* leader pid */
>>>  	struct pstree_item	*parent;
>>> +	struct list_head	children;	/* array of children */
>>>  	pid_t			pgid;
>>>  	pid_t			sid;
>>>  	int			state;		/* TASK_XXX constants */
>>> -	int			nr_children;	/* number of children */
>>>  	int			nr_threads;	/* number of threads */
>>>  	u32			*threads;	/* array of threads */
>>> -	u32			*children;	/* array of children */
>>>  	struct rst_info		*rst;
>>>  };
>>>  
>>
>>> +struct pstree_item *alloc_pstree_item()
>>> +{
>>> +struct pstree_item *pstree_item_next(struct pstree_item *item)
>>>  {
>>
>> Taking into account the fact you uses this in the restore also it's worth
>> moving the pstree items management into some generic .c file. E.g. util.c
>> or new pstree.c
> 
> Yes, I want to do that, but after you commit this patch.

How about the other comments?

>>
>> Thanks,
>> Pavel
> .
> 



More information about the CRIU mailing list