From: Sukadev Bhattiprolu <sukadev-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
To: "David C. Hansen" <haveblue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
Cc: Containers <containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org>
Subject: Re: [PATCH 0/6] /proc/pid/checkpointable
Date: Mon, 16 Mar 2009 23:39:58 -0700 [thread overview]
Message-ID: <20090317063958.GG2377@us.ibm.com> (raw)
In-Reply-To: <20090317062754.GA2377-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
From: Sukadev Bhattiprolu <sukadev-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
Date: Sat, 14 Mar 2009 10:21:07 -0700
Subject: [PATCH 6/6] Explain reason for task being uncheckpointable
Try to give an useful message on why a task is uncheckpointable.
Signed-off-by: Sukadev Bhattiprolu <sukadev-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
---
checkpoint/checkpoint.c | 13 +++++++++----
fs/proc/base.c | 19 ++++++++++++++++++-
include/linux/checkpoint.h | 7 +++++++
3 files changed, 34 insertions(+), 5 deletions(-)
diff --git a/checkpoint/checkpoint.c b/checkpoint/checkpoint.c
index ad0956c..c8c377d 100644
--- a/checkpoint/checkpoint.c
+++ b/checkpoint/checkpoint.c
@@ -264,18 +264,23 @@ static int cr_write_all_tasks(struct cr_ctx *ctx)
return ret;
}
-int task_checkpointable(struct task_struct *t)
+int __task_checkpointable(struct task_struct *t)
{
if (t->state == TASK_DEAD) {
pr_warning("c/r: task %d is TASK_DEAD\n", task_pid_vnr(t));
- return 0;
+ return CR_DEAD;
}
/* Verify that task is frozen, unless it is self-checkpoint */
if (t != current && !frozen(t))
- return 0;
+ return CR_NOT_FROZEN;
+
+ return CR_CHECKPOINTABLE;
+}
- return 1;
+int task_checkpointable(struct task_struct *t)
+{
+ return __task_checkpointable(t) == CR_CHECKPOINTABLE;
}
static int cr_may_checkpoint_task(struct task_struct *t, struct cr_ctx *ctx)
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 989ca93..6e4c07c 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -2502,9 +2502,26 @@ static int proc_pid_personality(struct seq_file *m, struct pid_namespace *ns,
}
#ifdef CONFIG_CHECKPOINT_RESTART
+static char *explain_checkpointable(int reason)
+{
+ char *message;
+
+ switch(reason) {
+ case CR_CHECKPOINTABLE: message = "1"; break;
+ case CR_DEAD: message = "0 (dead)"; break;
+ case CR_NOT_FROZEN: message = "0 (not frozen)"; break;
+ default: message = "0 (unknown)"; break;
+ }
+ return message;
+}
+
static int proc_pid_checkpointable(struct task_struct *task, char *buffer)
{
- return sprintf(buffer, "%d\n", task_checkpointable(task));
+ int rc;
+
+ rc = __task_checkpointable(task);
+
+ return scnprintf(buffer, PAGE_SIZE, "%s\n", explain_checkpointable(rc));
}
#endif
diff --git a/include/linux/checkpoint.h b/include/linux/checkpoint.h
index d1f53a6..a1eba73 100644
--- a/include/linux/checkpoint.h
+++ b/include/linux/checkpoint.h
@@ -142,6 +142,13 @@ static inline int cr_enabled(void)
return 1;
}
+enum cr_uncheckpointable_reason {
+ CR_CHECKPOINTABLE = 0,
+ CR_DEAD,
+ CR_NOT_FROZEN
+};
+
+int __task_checkpointable(struct task_struct *t);
int task_checkpointable(struct task_struct *t);
#else /* !CONFIG_CHECKPOINT_RESTART */
--
1.5.2.5
next prev parent reply other threads:[~2009-03-17 6:39 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-17 6:27 [PATCH 0/6] /proc/pid/checkpointable Sukadev Bhattiprolu
[not found] ` <20090317062754.GA2377-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-03-17 6:38 ` Sukadev Bhattiprolu
2009-03-17 6:38 ` Sukadev Bhattiprolu
2009-03-17 6:39 ` Sukadev Bhattiprolu
2009-03-17 6:39 ` Sukadev Bhattiprolu
2009-03-17 6:39 ` Sukadev Bhattiprolu
[not found] ` <20090317063940.GF2377-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-03-18 8:55 ` Oren Laadan
[not found] ` <49C0B6FF.5030104-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
2009-03-18 13:59 ` Serge E. Hallyn
[not found] ` <20090318135953.GE22636-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-03-18 16:16 ` Oren Laadan
[not found] ` <49C11E61.4010505-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
2009-03-18 16:24 ` Dave Hansen
2009-03-18 17:48 ` Oren Laadan
[not found] ` <49C133F9.2020505-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
2009-03-18 18:06 ` Dave Hansen
2009-03-18 16:23 ` Oren Laadan
[not found] ` <49C1201A.3050604-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
2009-03-18 17:18 ` Serge E. Hallyn
[not found] ` <20090318171840.GA29523-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-03-18 17:50 ` Oren Laadan
[not found] ` <49C1347F.3000601-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
2009-03-18 20:03 ` Mike Waychison
[not found] ` <49C153AF.7070504-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
2009-03-18 20:13 ` Dave Hansen
2009-03-25 12:25 ` Eric W. Biederman
[not found] ` <m17i2dx00b.fsf-+imSwln9KH6u2/kzUuoCbdi2O/JbrIOy@public.gmane.org>
2009-03-25 17:29 ` Serge E. Hallyn
[not found] ` <20090325172938.GA18957-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-03-26 9:52 ` Cedric Le Goater
[not found] ` <49CB504A.2080400-GANU6spQydw@public.gmane.org>
2009-03-26 13:29 ` Serge E. Hallyn
2009-03-18 14:42 ` Dave Hansen
2009-03-17 6:39 ` Sukadev Bhattiprolu [this message]
[not found] ` <20090317063958.GG2377-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-03-18 8:56 ` Oren Laadan
[not found] ` <49C0B750.4050109-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
2009-03-18 13:53 ` Serge E. Hallyn
2009-03-17 6:55 ` Sukadev Bhattiprolu
-- strict thread matches above, loose matches on Subject: below --
2009-03-17 17:43 Sukadev Bhattiprolu
[not found] ` <20090317174359.GA10796-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-03-18 9:28 ` Oren Laadan
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=20090317063958.GG2377@us.ibm.com \
--to=sukadev-23vcf4htsmix0ybbhkvfkdbpr1lh4cv8@public.gmane.org \
--cc=containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org \
--cc=haveblue-r/Jw6+rmf7HQT0dZR+AlfA@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox