All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matt Helsley <matthltc-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
To: Nathan Lynch <ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org>
Cc: containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
Subject: Re: [PATCH] checkpoint: conditionally schedule; check for fatal signals
Date: Thu, 18 Nov 2010 15:03:35 -0800	[thread overview]
Message-ID: <20101118230335.GD27736@count0.beaverton.ibm.com> (raw)
In-Reply-To: <1290115265-19038-1-git-send-email-ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org>

On Thu, Nov 18, 2010 at 03:21:05PM -0600, Nathan Lynch wrote:
> Long-running operations in the kernel should:
> 
> o  not monopolize the CPU
> o  abort when asked
> 
> Put voluntary preemption points in ckpt_kread, ckpt_kwrite, and the
> VMA-walking checkpoint code.  At the same points, return an error if a
> fatal signal is pending; callers of these functions are supposed to be
> checking return values.

We do alot more than read/write the image -- e.g. collecting references at
the beginning prior to checkpoint. Perhaps should add some to the objhash
code too.

Cheers,
	-Matt Helsley

> 
> Signed-off-by: Nathan Lynch <ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org>
> ---
>  kernel/checkpoint/sys.c |   10 ++++++++++
>  mm/checkpoint.c         |    7 +++++++
>  2 files changed, 17 insertions(+), 0 deletions(-)
> 
> diff --git a/kernel/checkpoint/sys.c b/kernel/checkpoint/sys.c
> index b761ec0..04e6277 100644
> --- a/kernel/checkpoint/sys.c
> +++ b/kernel/checkpoint/sys.c
> @@ -72,6 +72,11 @@ int ckpt_kwrite(struct ckpt_ctx *ctx, void *addr, size_t count)
>  	if (ckpt_test_error(ctx))
>  		return ckpt_get_error(ctx);
> 
> +	if (fatal_signal_pending(current))
> +		return -EINTR;
> +
> +	cond_resched();
> +
>  	ret = _ckpt_kwrite(ctx->file, addr, count);
>  	if (ret < 0)
>  		return ret;
> @@ -103,6 +108,11 @@ int ckpt_kread(struct ckpt_ctx *ctx, void *addr, size_t count)
>  	if (ckpt_test_error(ctx))
>  		return ckpt_get_error(ctx);
> 
> +	if (fatal_signal_pending(current))
> +		return -EINTR;
> +
> +	cond_resched();
> +
>  	ret = _ckpt_kread(ctx->file, addr, count);
>  	if (ret < 0)
>  		return ret;
> diff --git a/mm/checkpoint.c b/mm/checkpoint.c
> index 70300e8..6732a2e 100644
> --- a/mm/checkpoint.c
> +++ b/mm/checkpoint.c
> @@ -310,6 +310,13 @@ static int vma_fill_pgarr(struct ckpt_ctx *ctx,
>  		while (addr < end) {
>  			struct page *page;
> 
> +			if (fatal_signal_pending(current)) {
> +				cnt = -EINTR;
> +				goto out;
> +			}
> +
> +			cond_resched();
> +
>  			if (vma)
>  				page = consider_private_page(vma, addr);
>  			else
> -- 
> 1.7.3.2
> 
> _______________________________________________
> Containers mailing list
> Containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
> https://lists.linux-foundation.org/mailman/listinfo/containers

      parent reply	other threads:[~2010-11-18 23:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-18 21:21 [PATCH] checkpoint: conditionally schedule; check for fatal signals Nathan Lynch
     [not found] ` <1290115265-19038-1-git-send-email-ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org>
2010-11-18 23:03   ` Matt Helsley [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20101118230335.GD27736@count0.beaverton.ibm.com \
    --to=matthltc-r/jw6+rmf7hqt0dzr+alfa@public.gmane.org \
    --cc=containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
    --cc=ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.