[CRIU] [PATCH 06/16] mem/vma: Use vm_area_list_init where appropriate

Mike Rapoport rppt at linux.ibm.com
Mon Jul 8 15:37:49 MSK 2019


On Fri, Jul 05, 2019 at 06:38:01PM +0300, Cyrill Gorcunov wrote:
> Signed-off-by: Cyrill Gorcunov <gorcunov at gmail.com>

Reviewed-by: Mike Rapoport <rppt at linux.ibm.com>

> ---
>  criu/cr-dump.c    | 9 +++------
>  criu/proc_parse.c | 7 +------
>  2 files changed, 4 insertions(+), 12 deletions(-)
> 
> diff --git a/criu/cr-dump.c b/criu/cr-dump.c
> index 7f2e5edfc52a..9b891497b53f 100644
> --- a/criu/cr-dump.c
> +++ b/criu/cr-dump.c
> @@ -109,8 +109,7 @@ void free_mappings(struct vm_area_list *vma_area_list)
>  		free(vma_area);
>  	}
>  
> -	INIT_LIST_HEAD(&vma_area_list->h);
> -	vma_area_list->nr = 0;
> +	vm_area_list_init(vma_area_list);
>  }
>  
>  int collect_mappings(pid_t pid, struct vm_area_list *vma_area_list,
> @@ -1139,8 +1138,7 @@ static int pre_dump_one_task(struct pstree_item *item, InventoryEntry *parent_ie
>  	struct parasite_dump_misc misc;
>  	struct mem_dump_ctl mdc;
>  
> -	INIT_LIST_HEAD(&vmas.h);
> -	vmas.nr = 0;
> +	vm_area_list_init(&vmas);
>  
>  	pr_info("========================================\n");
>  	pr_info("Pre-dumping task (pid: %d)\n", pid);
> @@ -1221,8 +1219,7 @@ static int dump_one_task(struct pstree_item *item, InventoryEntry *parent_ie)
>  	struct proc_posix_timers_stat proc_args;
>  	struct mem_dump_ctl mdc;
>  
> -	INIT_LIST_HEAD(&vmas.h);
> -	vmas.nr = 0;
> +	vm_area_list_init(&vmas);
>  
>  	pr_info("========================================\n");
>  	pr_info("Dumping task (pid: %d)\n", pid);
> diff --git a/criu/proc_parse.c b/criu/proc_parse.c
> index f6ebb1fd6f50..4c127f264062 100644
> --- a/criu/proc_parse.c
> +++ b/criu/proc_parse.c
> @@ -705,12 +705,7 @@ int parse_smaps(pid_t pid, struct vm_area_list *vma_area_list,
>  	DIR *map_files_dir = NULL;
>  	struct bfd f;
>  
> -	vma_area_list->nr = 0;
> -	vma_area_list->nr_aios = 0;
> -	vma_area_list->priv_longest = 0;
> -	vma_area_list->priv_size = 0;
> -	vma_area_list->shared_longest = 0;
> -	INIT_LIST_HEAD(&vma_area_list->h);
> +	vm_area_list_init(vma_area_list);
>  
>  	f.fd = open_proc(pid, "smaps");
>  	if (f.fd < 0)
> -- 
> 2.20.1
> 
> _______________________________________________
> CRIU mailing list
> CRIU at openvz.org
> https://lists.openvz.org/mailman/listinfo/criu
> 

-- 
Sincerely yours,
Mike.



More information about the CRIU mailing list