checkpoint: conditionally schedule; check for fatal signals
PATCH 1/1 checkpoint: conditionally schedule; check for fatal signals
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.
--- kernel/checkpoint/sys.c | 10 ++++++++++ mm/checkpoint.c | 7 +++++++ 2 files changed, 17 insertions(+), 0 deletions(-)
kernel/checkpoint/sys.c +10 -0
@@ -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;
mm/checkpoint.c +7 -0
@@ -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
Signature · 1 line
1.7.3.2
A message that is not in the archive (sent off-list or not yet received): 1290115265-19038-1-git-send-email-ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org
Quoted 9 lines · Nathan Lynch
Long-running operations in the kernel should:
o not monopolize the CPU
o abort when askedPut 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
Quoted 60 lines
Signed-off-by Nathan Lynch <[email protected]>--- kernel/checkpoint/sys.c | 10 ++++++++++ mm/checkpoint.c | 7 +++++++ 2 files changed, 17 insertions(+), 0 deletions(-)kernel/checkpoint/sys.c +10
-0@@ -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;mm/checkpoint.c +7
-0@@ -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 Signature · 6 lines
1.7.3.2 _______________________________________________ Containers mailing list Containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org https://lists.linux-foundation.org/mailman/listinfo/containers