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

Andrew Vagin avagin at parallels.com
Wed May 30 09:53:19 EDT 2012


> > @@ -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)

> 
> >  	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.
> 
> Thanks,
> Pavel


More information about the CRIU mailing list