From: Greg Kurz <gkurz@fr.ibm.com>
To: Dave Hansen <dave@linux.vnet.ibm.com>
Cc: Oren Laadan <orenl@cs.columbia.edu>,
containers@lists.linux-foundation.org,
Ingo Molnar <mingo@elte.hu>,
linux-kernel@vger.kernel.org, arnd@arndb.de
Subject: Re: [RFC][PATCH 1/2] Track in-kernel when we expect checkpoint/restart to work
Date: Fri, 10 Oct 2008 10:20:34 +0200 [thread overview]
Message-ID: <1223626834.8787.8.camel@localhost.localdomain> (raw)
In-Reply-To: <20081009190405.13A253CB@kernel>
On Thu, 2008-10-09 at 12:04 -0700, Dave Hansen wrote:
> Suggested by Ingo.
>
> Checkpoint/restart is going to be a long effort to get things working.
> We're going to have a lot of things that we know just don't work for
> a long time. That doesn't mean that it will be useless, it just means
> that there's some complicated features that we are going to have to
> work incrementally to fix.
>
> This patch introduces a new mechanism to help the checkpoint/restart
> developers. A new function pair: task/process_deny_checkpoint() is
> created. When called, these tell the kernel that we *know* that the
> process has performed some activity that will keep it from being
> properly checkpointed.
>
> The 'flag' is an atomic_t for now so that we can have some level
> of atomicity and make sure to only warn once.
>
> For now, this is a one-way trip. Once a process is no longer
> 'may_checkpoint' capable, neither it nor its children ever will be.
> This can, of course, be fixed up in the future. We might want to
> reset the flag when a new pid namespace is created, for instance.
>
Then this patch should be described as:
Track in-kernel when we expect checkpoint/restart to fail.
By the way, why don't you introduce the reverse operation ?
>
> Signed-off-by: Dave Hansen <dave@linux.vnet.ibm.com>
> ---
>
> linux-2.6.git-dave/include/linux/checkpoint.h | 31 +++++++++++++++++++++++++-
> linux-2.6.git-dave/include/linux/sched.h | 3 ++
> linux-2.6.git-dave/kernel/fork.c | 10 ++++++++
> 3 files changed, 43 insertions(+), 1 deletion(-)
>
> diff -puN include/linux/checkpoint.h~flag include/linux/checkpoint.h
> --- linux-2.6.git/include/linux/checkpoint.h~flag 2008-10-09 11:56:57.000000000 -0700
> +++ linux-2.6.git-dave/include/linux/checkpoint.h 2008-10-09 11:56:57.000000000 -0700
> @@ -10,8 +10,11 @@
> * distribution for more details.
> */
>
> -#include <linux/path.h>
> #include <linux/fs.h>
> +#include <linux/path.h>
> +#include <linux/sched.h>
> +
> +#ifdef CONFIG_CHECKPOINT_RESTART
>
> #define CR_VERSION 2
>
> @@ -94,4 +97,30 @@ extern void file_pos_write(struct file *
> #define cr_debug(fmt, args...) \
> pr_debug("[CR:%s] " fmt, __func__, ## args)
>
> +static inline void __task_deny_checkpointing(struct task_struct *task,
> + char *file, int line)
> +{
> + if(!atomic_dec_and_test(&task->may_checkpoint))
> + return;
> + printk(KERN_INFO "process performed an action that can not be "
> + "checkpointed at: %s:%d\n", file, line);
> + WARN_ON(1);
> +}
> +#define process_deny_checkpointing(p) __task_deny_checkpointing(p, __FILE__, __LINE__)
> +
> +/*
> + * For now, we're not going to have a distinction between
> + * tasks and processes for the purpose of c/r. But, allow
> + * these two calls anyway to make new users at least think
> + * about it.
> + */
> +#define task_deny_checkpointing(p) __task_deny_checkpointing(p, __FILE__, __LINE__)
> +
> +#else
> +
> +static inline void task_deny_checkpointing(struct task_struct *task) {}
> +static inline void process_deny_checkpointing(struct task_struct *task) {}
> +
> +#endif
> +
> #endif /* _CHECKPOINT_CKPT_H_ */
> diff -puN include/linux/sched.h~flag include/linux/sched.h
> --- linux-2.6.git/include/linux/sched.h~flag 2008-10-09 11:56:57.000000000 -0700
> +++ linux-2.6.git-dave/include/linux/sched.h 2008-10-09 11:56:57.000000000 -0700
> @@ -1301,6 +1301,9 @@ struct task_struct {
> int latency_record_count;
> struct latency_record latency_record[LT_SAVECOUNT];
> #endif
> +#ifdef CONFIG_CHECKPOINT_RESTART
> + atomic_t may_checkpoint;
> +#endif
> };
>
> /*
> diff -puN kernel/fork.c~flag kernel/fork.c
> --- linux-2.6.git/kernel/fork.c~flag 2008-10-09 11:56:57.000000000 -0700
> +++ linux-2.6.git-dave/kernel/fork.c 2008-10-09 11:56:57.000000000 -0700
> @@ -194,6 +194,13 @@ void __init fork_init(unsigned long memp
> init_task.signal->rlim[RLIMIT_NPROC].rlim_max = max_threads/2;
> init_task.signal->rlim[RLIMIT_SIGPENDING] =
> init_task.signal->rlim[RLIMIT_NPROC];
> +
> +#ifdef CONFIG_CHECKPOINT_RESTART
> + /*
> + * This probably won't stay set for long...
> + */
> + atomic_set(&init_task.may_checkpoint, 1);
> +#endif
> }
>
> int __attribute__((weak)) arch_dup_task_struct(struct task_struct *dst,
> @@ -244,6 +251,9 @@ static struct task_struct *dup_task_stru
> tsk->btrace_seq = 0;
> #endif
> tsk->splice_pipe = NULL;
> +#ifdef CONFIG_CHECKPOINT_RESTART
> + atomic_set(&tsk->may_checkpoint, atomic_read(&orig->may_checkpoint));
> +#endif
> return tsk;
>
> out:
> _
> _______________________________________________
> Containers mailing list
> Containers@lists.linux-foundation.org
> https://lists.linux-foundation.org/mailman/listinfo/containers
--
Gregory Kurz gkurz@fr.ibm.com
Software Engineer @ IBM/Meiosys http://www.ibm.com
Tel +33 (0)534 638 479 Fax +33 (0)561 400 420
"Anarchy is about taking complete responsibility for yourself."
Alan Moore.
next prev parent reply other threads:[~2008-10-10 8:21 UTC|newest]
Thread overview: 70+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-09 19:04 [RFC][PATCH 1/2] Track in-kernel when we expect checkpoint/restart to work Dave Hansen
2008-10-09 19:04 ` [RFC][PATCH 2/2] first callers of process_deny_checkpoint() Dave Hansen
2008-10-09 19:04 ` Dave Hansen
2008-10-09 19:43 ` Serge E. Hallyn
2008-10-09 19:43 ` Serge E. Hallyn
[not found] ` <20081009194350.GA31214-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2008-10-09 20:54 ` Dave Hansen
2008-10-09 20:54 ` Dave Hansen
2008-10-10 8:46 ` Ingo Molnar
2008-10-10 8:46 ` Ingo Molnar
2008-10-10 13:17 ` Rafael J. Wysocki
2008-10-10 14:54 ` Ingo Molnar
2008-10-10 19:53 ` Rafael J. Wysocki
2008-10-10 19:53 ` Ingo Molnar
[not found] ` <20081010195339.GA509-X9Un+BFzKDI@public.gmane.org>
2008-10-10 20:40 ` Len Brown
2008-10-10 22:57 ` Rafael J. Wysocki
2008-10-10 20:40 ` Len Brown
2008-10-10 22:57 ` Rafael J. Wysocki
[not found] ` <200810102153.45174.rjw-KKrjLPT3xs0@public.gmane.org>
2008-10-10 19:53 ` Ingo Molnar
[not found] ` <20081010145422.GE11695-X9Un+BFzKDI@public.gmane.org>
2008-10-10 19:53 ` Rafael J. Wysocki
[not found] ` <200810101517.17809.rjw-KKrjLPT3xs0@public.gmane.org>
2008-10-10 14:54 ` Ingo Molnar
2008-10-11 13:48 ` Pavel Machek
2008-10-11 15:00 ` Ingo Molnar
[not found] ` <20081011134803.GA1483-+ZI9xUNit7I@public.gmane.org>
2008-10-11 15:00 ` Ingo Molnar
[not found] ` <20081010084614.GA319-X9Un+BFzKDI@public.gmane.org>
2008-10-10 13:17 ` Rafael J. Wysocki
2008-10-11 13:48 ` Pavel Machek
2008-10-10 10:27 ` Cedric Le Goater
2008-10-10 10:27 ` Cedric Le Goater
2008-10-10 8:41 ` Daniel Lezcano
2008-10-10 8:41 ` Daniel Lezcano
2008-10-10 10:17 ` Cedric Le Goater
2008-10-10 14:04 ` Serge E. Hallyn
[not found] ` <20081010140430.GA14640-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2008-10-10 16:45 ` Greg Kurz
2008-10-10 16:45 ` Greg Kurz
2008-10-10 17:13 ` Serge E. Hallyn
2008-10-10 17:28 ` Dave Hansen
2008-10-13 8:20 ` Greg Kurz
2008-10-13 8:20 ` Greg Kurz
[not found] ` <1223657132.10017.42.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2008-10-10 17:13 ` Serge E. Hallyn
2008-10-10 17:28 ` Dave Hansen
[not found] ` <48EF2BAB.1010009-NmTC/0ZBporQT0dZR+AlfA@public.gmane.org>
2008-10-10 14:04 ` Serge E. Hallyn
2008-10-10 10:17 ` Cedric Le Goater
2008-10-10 8:20 ` [RFC][PATCH 1/2] Track in-kernel when we expect checkpoint/restart to work Greg Kurz
2008-10-10 8:20 ` Greg Kurz [this message]
[not found] ` <1223626834.8787.8.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2008-10-10 8:37 ` Daniel Lezcano
2008-10-10 8:37 ` Daniel Lezcano
2008-10-10 10:11 ` Oren Laadan
2008-10-10 14:59 ` Ingo Molnar
2008-10-10 15:17 ` Oren Laadan
2008-10-10 15:28 ` Ingo Molnar
[not found] ` <48EF7211.2000303-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
2008-10-10 15:28 ` Ingo Molnar
2008-10-10 16:34 ` Greg Kurz
2008-10-10 16:34 ` Greg Kurz
2008-10-10 17:18 ` Chris Friesen
2008-10-13 8:18 ` Greg Kurz
[not found] ` <1223885897.4404.5.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2008-10-13 16:46 ` Serge E. Hallyn
2008-10-13 16:46 ` Serge E. Hallyn
[not found] ` <48EF8E77.8050000-ZIRUuHA3oDzQT0dZR+AlfA@public.gmane.org>
2008-10-13 8:18 ` Greg Kurz
[not found] ` <1223656489.10017.33.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2008-10-10 16:36 ` Dave Hansen
2008-10-10 16:36 ` Dave Hansen
2008-10-10 20:57 ` Daniel Lezcano
2008-10-10 20:57 ` Daniel Lezcano
2008-10-10 17:18 ` Chris Friesen
[not found] ` <20081010145934.GF11695-X9Un+BFzKDI@public.gmane.org>
2008-10-10 15:17 ` Oren Laadan
[not found] ` <48EF144D.1050906-NmTC/0ZBporQT0dZR+AlfA@public.gmane.org>
2008-10-10 8:47 ` Greg Kurz
2008-10-10 8:47 ` Greg Kurz
2008-10-10 10:11 ` Oren Laadan
2008-10-10 14:59 ` Ingo Molnar
2008-10-10 16:33 ` Dave Hansen
2008-10-10 16:33 ` Dave Hansen
-- strict thread matches above, loose matches on Subject: below --
2008-10-09 19:04 Dave Hansen
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=1223626834.8787.8.camel@localhost.localdomain \
--to=gkurz@fr.ibm.com \
--cc=arnd@arndb.de \
--cc=containers@lists.linux-foundation.org \
--cc=dave@linux.vnet.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--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 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.