From: Andrey Mirkin <major@openvz.org>
To: orenl@cs.columbia.edu, containers@lists.linux-foundation.org
Cc: linux-kernel@vger.kernel.org, Andrey Mirkin <major@openvz.org>
Subject: [PATCH 1/2] Add flags for user-space and in-kernel process creation
Date: Mon, 24 Nov 2008 18:39:34 +0300 [thread overview]
Message-ID: <1227541175-30301-2-git-send-email-major@openvz.org> (raw)
In-Reply-To: <1227541175-30301-1-git-send-email-major@openvz.org>
Introduce 2 flags for user-space and in-kernel process creation during
restart procedure.
Also a stub function for in-kernel process restart is introduced.
Signed-off-by: Andrey Mirkin <major@openvz.org>
---
checkpoint/Makefile | 2 +-
checkpoint/restart.c | 4 +++-
checkpoint/rstr_process.c | 20 ++++++++++++++++++++
checkpoint/sys.c | 4 ++--
include/linux/checkpoint.h | 3 +++
5 files changed, 29 insertions(+), 4 deletions(-)
create mode 100644 checkpoint/rstr_process.c
diff --git a/checkpoint/Makefile b/checkpoint/Makefile
index 88bbc10..7ead290 100644
--- a/checkpoint/Makefile
+++ b/checkpoint/Makefile
@@ -3,4 +3,4 @@
#
obj-$(CONFIG_CHECKPOINT_RESTART) += sys.o checkpoint.o restart.o objhash.o \
- ckpt_mem.o rstr_mem.o ckpt_file.o rstr_file.o
+ ckpt_mem.o rstr_mem.o ckpt_file.o rstr_file.o rstr_process.o
diff --git a/checkpoint/restart.c b/checkpoint/restart.c
index 5360c40..9259622 100644
--- a/checkpoint/restart.c
+++ b/checkpoint/restart.c
@@ -461,7 +461,9 @@ int do_restart(struct cr_ctx *ctx, pid_t pid)
{
int ret;
- if (ctx)
+ if (ctx && (ctx->flags & CR_CTX_RSTR_IN_KERNEL))
+ ret = do_restart_in_kernel(ctx);
+ else if (ctx)
ret = do_restart_root(ctx, pid);
else
ret = do_restart_task(ctx, pid);
diff --git a/checkpoint/rstr_process.c b/checkpoint/rstr_process.c
new file mode 100644
index 0000000..ec9e51b
--- /dev/null
+++ b/checkpoint/rstr_process.c
@@ -0,0 +1,20 @@
+/*
+ * In-kernel process creation
+ *
+ * Copyright (C) 2008 Parallels, Inc.
+ *
+ * Author: Andrey Mirkin <major@openvz.org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, version 2 of the
+ * License.
+ *
+ */
+
+#include <linux/checkpoint.h>
+
+int do_restart_in_kernel(struct cr_ctx *ctx)
+{
+ return -ENOSYS;
+}
diff --git a/checkpoint/sys.c b/checkpoint/sys.c
index 7745500..e4a9287 100644
--- a/checkpoint/sys.c
+++ b/checkpoint/sys.c
@@ -264,8 +264,8 @@ asmlinkage long sys_restart(int crid, int fd, unsigned long flags)
pid_t pid;
int ret;
- /* no flags for now */
- if (flags)
+ if ((flags & (CR_CTX_RSTR_IN_USERSPACE | CR_CTX_RSTR_IN_USERSPACE)) ==
+ (CR_CTX_RSTR_IN_USERSPACE | CR_CTX_RSTR_IN_USERSPACE))
return -EINVAL;
/* FIXME: for now, we use 'crid' as a pid */
diff --git a/include/linux/checkpoint.h b/include/linux/checkpoint.h
index cab5e19..947469a 100644
--- a/include/linux/checkpoint.h
+++ b/include/linux/checkpoint.h
@@ -61,6 +61,8 @@ struct cr_ctx {
/* cr_ctx: flags */
#define CR_CTX_CKPT 0x1
#define CR_CTX_RSTR 0x2
+#define CR_CTX_RSTR_IN_USERSPACE 0x4
+#define CR_CTX_RSTR_IN_KERNEL 0x8
extern int cr_kwrite(struct cr_ctx *ctx, void *buf, int count);
extern int cr_kread(struct cr_ctx *ctx, void *buf, int count);
@@ -108,6 +110,7 @@ extern int cr_write_mm(struct cr_ctx *ctx, struct task_struct *t);
extern int cr_write_files(struct cr_ctx *ctx, struct task_struct *t);
extern int do_restart(struct cr_ctx *ctx, pid_t pid);
+extern int do_restart_in_kernel(struct cr_ctx *ctx);
extern int cr_read_mm(struct cr_ctx *ctx);
extern int cr_read_files(struct cr_ctx *ctx);
--
1.5.6
next prev parent reply other threads:[~2008-11-24 15:40 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-24 15:39 [PATCH 0/2] In-kernel process restart Andrey Mirkin
2008-11-24 15:39 ` Andrey Mirkin [this message]
2008-11-24 15:39 ` [PATCH 2/2] Add support for in-kernel process creation during restart Andrey Mirkin
2008-11-25 0:45 ` Alexey Dobriyan
2008-11-26 5:07 ` Andrey Mirkin
2008-11-25 20:17 ` Oren Laadan
2008-11-26 11:58 ` Andrey Mirkin
2008-11-24 16:02 ` [PATCH 1/2] Add flags for user-space and in-kernel process creation Louis Rilling
2008-11-26 4:55 ` Andrey Mirkin
2008-11-25 20:02 ` [PATCH 0/2] In-kernel process restart Oren Laadan
2008-11-26 11:44 ` Andrey Mirkin
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=1227541175-30301-2-git-send-email-major@openvz.org \
--to=major@openvz.org \
--cc=containers@lists.linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=orenl@cs.columbia.edu \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox