[CRIU] [PATCH] mem: Don't track memory changes if --track-mem is not specified

Cyrill Gorcunov gorcunov at gmail.com
Thu Jan 16 02:58:11 PST 2014


On Thu, Jan 16, 2014 at 02:43:06PM +0400, Pavel Emelyanov wrote:
> --- a/mem.c
> +++ b/mem.c
> @@ -43,11 +43,7 @@ static int task_reset_dirty_track(int pid)
>  	if (!opts.track_mem)
>  		return 0;
>  
> -	if (!kerndat_has_dirty_track) {
> -		pr_err("Kernel doesn't support dirty tracking. "
> -				"No snapshot available.\n");
> -		return -1;
> -	}
> +	BUG_ON(!kerndat_has_dirty_track);
>  
>  	return do_task_reset_dirty_track(pid);
>  }
> @@ -81,6 +77,17 @@ static struct mem_snap_ctx *mem_snap_init(struct parasite_ctl *ctl)
>  	int p_fd, pm_fd;
>  	PagemapHead *h;
>  
> +	/*
> +	 * If we're not tracking memory changes, then it doesn't
> +	 * matter whether we have parent images or not. Just
> +	 * proceed with full memory dump.
> +	 */
> +
> +	if (!opts.track_mem)
> +		return NULL;
> +
> +	BUG_ON(!kerndat_has_dirty_track);

Are these BUG_ON really needed? I mean what happen if we drop them?


More information about the CRIU mailing list