[CRIU] [PATCH v2] lazy-pages: treat ENOMEM returned by UFFDIO_UNREGISTER as task exit

Andrei Vagin avagin at virtuozzo.com
Tue Oct 10 03:57:25 MSK 2017


Applied, thanks!

On Sun, Oct 08, 2017 at 09:26:53AM +0300, Mike Rapoport wrote:
> The UFFDIO_UNREGISTER returns ENOMEM only when it is unable to get
> mm_struct. We can assume in such case that the task is exited.
> 
> Signed-off-by: Mike Rapoport <rppt at linux.vnet.ibm.com>
> ---
> v2: added comment as per maintainer request
> 
>  criu/uffd.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/criu/uffd.c b/criu/uffd.c
> index 7e85890..740f5e3 100644
> --- a/criu/uffd.c
> +++ b/criu/uffd.c
> @@ -914,6 +914,15 @@ static int handle_remove(struct lazy_pages_info *lpi, struct uffd_msg *msg)
>  	 */
>  	if (msg->event == UFFD_EVENT_REMOVE &&
>  	    ioctl(lpi->lpfd.fd, UFFDIO_UNREGISTER, &unreg)) {
> +		/*
> +		 * The kernel returns -ENOMEM when unregister is
> +		 * called after the process has gone
> +		 */
> +		if (errno == ENOMEM) {
> +			handle_exit(lpi);
> +			return 0;
> +		}
> +
>  		pr_perror("Failed to unregister (%llx - %llx)", unreg.start,
>  			  unreg.start + unreg.len);
>  		return -1;
> -- 
> 2.7.4
> 


More information about the CRIU mailing list