[CRIU] [PATCH] scripts: Add ACT_PRE_RESUME stage

Pavel Emelyanov xemul at virtuozzo.com
Tue Jan 10 05:27:23 PST 2017


On 01/10/2017 04:18 PM, Cyrill Gorcunov wrote:
> On Tue, Jan 10, 2017 at 03:51:10PM +0300, Pavel Emelyanov wrote:
>> On 01/09/2017 05:44 PM, Cyrill Gorcunov wrote:
>>> The "post-sigreturn" action is when all tasks are restored
>>> but not yet restarted sitting in frozen/seized state, right
>>> after final rt-sigreturn call passed.
>>>
>>> In vz7 this step is needed to tune up beancounters/cgroups
>>> params from the script, in vanilla criu it useful as well.
>>
>> We have POST_RESTORE hook. If it happens too early (why?) let's
>> move it into proper place?
> 
> It happens early for vz7 case: we're inside veX and continue
> manipulating with resources which can lead up to problems
> with beancounters and memory limits. I suspect LXC and friends
> won't hit this problem for now. We could move POST_RESTORE
> hook to trigger later but this will break API I think, we simply
> can't be sure that someone already is using this hook in this
> particular place.
> 
> What about naming it as pre-resume?

Can you describe what exactly happens between POST_RESTORE and PRE_RESUME?

> ---
> From: Cyrill Gorcunov <gorcunov at openvz.org>
> Subject: [PATCH] action-scripts: Add "pre-resume" stage
> 
> The main idea is to be able to operate with container
> at the moment where its processess and resources are
> already restored but the processes are not yet running,
> ie just before we kick them.
> 
> Beside the need of tuning up beancounters (which is vz7
> specific feature) this might be useful to make some
> additional debug tests from the script.
> 
> Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
> ---
>  criu/action-scripts.c         | 1 +
>  criu/cr-restore.c             | 4 ++++
>  criu/include/action-scripts.h | 1 +
>  3 files changed, 6 insertions(+)
> 
> diff --git a/criu/action-scripts.c b/criu/action-scripts.c
> index bfa1f827acb2..e3027bd2ea8a 100644
> --- a/criu/action-scripts.c
> +++ b/criu/action-scripts.c
> @@ -23,6 +23,7 @@ static const char *action_names[ACT_MAX] = {
>  	[ ACT_NET_UNLOCK ]	= "network-unlock",
>  	[ ACT_SETUP_NS ]	= "setup-namespaces",
>  	[ ACT_POST_SETUP_NS ]	= "post-setup-namespaces",
> +	[ ACT_PRE_RESUME ]	= "pre-resume",
>  	[ ACT_POST_RESUME ]	= "post-resume",
>  };
>  
> diff --git a/criu/cr-restore.c b/criu/cr-restore.c
> index 1c87c6ed3f5d..f326251ca82e 100644
> --- a/criu/cr-restore.c
> +++ b/criu/cr-restore.c
> @@ -1962,6 +1962,10 @@ static int restore_root_task(struct pstree_item *init)
>  	if (ret == 0)
>  		finalize_restore();
>  
> +	ret = run_scripts(ACT_PRE_RESUME);
> +	if (ret)
> +		pr_err("Pre-resume script ret code %d\n", ret);
> +
>  skip_for_check:
>  	if (restore_freezer_state())
>  		pr_err("Unable to restore freezer state\n");
> diff --git a/criu/include/action-scripts.h b/criu/include/action-scripts.h
> index 2e3b25ea3b21..4421169fd9cc 100644
> --- a/criu/include/action-scripts.h
> +++ b/criu/include/action-scripts.h
> @@ -11,6 +11,7 @@ enum script_actions {
>  	ACT_SETUP_NS,
>  	ACT_POST_SETUP_NS,
>  	ACT_POST_RESUME,
> +	ACT_PRE_RESUME,
>  
>  	ACT_MAX
>  };
> 



More information about the CRIU mailing list