[CRIU] [PATCH 2/7] parasite: Rework init to be able to handle per-threads data

Pavel Emelyanov xemul at parallels.com
Tue Nov 6 04:01:59 EST 2012


On 11/05/2012 12:06 AM, Cyrill Gorcunov wrote:
> 
> The threads have own blocked signals set thus we will need
> to keep the mask in dynamically allocated memory. This patch
> prepares the ground for further patches makes init() procedure
> to allocate the needed memory slab.
> 
> Same time we move @old_blocked and @reset_blocked which were
> per-parasite to per-thread memory.
> 
> Note that per-thread here is not the same as TLS or a per-cpu
> variables in kernel. It rather means we allocate memory area
> where each thread will have own offset for data it may use.
> 
> Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
> ---
>  cr-dump.c                  |    2 +-
>  include/parasite-syscall.h |    1 +
>  include/parasite.h         |    3 ++
>  parasite-syscall.c         |    8 ++++--
>  parasite.c                 |   50 +++++++++++++++++++++++++++++++++----------
>  5 files changed, 48 insertions(+), 16 deletions(-)
> 

> static int fini(void)
>  {
> -	if (reset_blocked == 1)
> -		sys_sigprocmask(SIG_SETMASK, &old_blocked, NULL, sizeof(k_rtsigset_t));
> +	int ret = 0, i;
> +
> +	for (i = 0; i < nr_tid_state; i++) {
> +		if (tid_state[i].use_sig_blocked) {
> +			ret |= sys_sigprocmask(SIG_SETMASK, &tid_state[i].sig_blocked,
> +					       NULL, sizeof(k_rtsigset_t));
> +		}

WTF is that???

> +	}
>  
>  	log_set_fd(-1);
>  	sys_close(tsock);
>  	brk_fini();
>  
> -	return 0;
> +	return ret;
>  }



More information about the CRIU mailing list