All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Serge E. Hallyn" <serue@us.ibm.com>
To: Dave Hansen <haveblue@us.ibm.com>, Ingo Molnar <mingo@elte.hu>,
	Oren Laadan <orenl@cs.columbia.edu>,
	Alexey Dobriyan <adobriyan@gmail.com>,
	Cedric Le Goater <clg@fr.ibm.com>
Cc: lkml <linux-kernel@vger.kernel.org>,
	Linux Containers <containers@lists.osdl.org>
Subject: [PATCH 2/3] cr: add file checkpointability to /proc/pid/status
Date: Fri, 6 Mar 2009 13:59:37 -0600	[thread overview]
Message-ID: <20090306195937.GA9632@us.ibm.com> (raw)
In-Reply-To: <20090306195911.GA9512@us.ibm.com>

Add file checkpointability info at the end of /proc/pid/status
output.  This will next be augmented by vm checkpointability
info.

Signed-off-by: Serge E. Hallyn <serue@us.ibm.com>
---
 checkpoint/checkpoint.c    |   14 ++++++++++++++
 fs/proc/array.c            |    2 ++
 include/linux/checkpoint.h |    4 ++++
 3 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/checkpoint/checkpoint.c b/checkpoint/checkpoint.c
index e0af8a2..5debe70 100644
--- a/checkpoint/checkpoint.c
+++ b/checkpoint/checkpoint.c
@@ -21,12 +21,26 @@
 #include <linux/magic.h>
 #include <linux/checkpoint.h>
 #include <linux/checkpoint_hdr.h>
+#include <linux/seq_file.h>
 
 #include "checkpoint_arch.h"
 
 /* unique checkpoint identifier (FIXME: should be per-container ?) */
 static atomic_t cr_ctx_count = ATOMIC_INIT(0);
 
+void task_checkpoint_status(struct seq_file *m, struct task_struct *p)
+{
+	if (!p->files) {
+		seq_printf(m, "task has no files_struct\n");
+		return;
+	}
+
+	if (test_bit(0, &p->files->may_checkpoint))
+		seq_printf(m, "files are checkpointable\n");
+	else
+		seq_printf(m, "files are not checkpointable\n");
+}
+
 /**
  * cr_write_obj - write a record described by a cr_hdr
  * @ctx: checkpoint context
diff --git a/fs/proc/array.c b/fs/proc/array.c
index 7e4877d..f350e45 100644
--- a/fs/proc/array.c
+++ b/fs/proc/array.c
@@ -81,6 +81,7 @@
 #include <linux/seq_file.h>
 #include <linux/pid_namespace.h>
 #include <linux/tracehook.h>
+#include <linux/checkpoint.h>
 
 #include <asm/pgtable.h>
 #include <asm/processor.h>
@@ -339,6 +340,7 @@ int proc_pid_status(struct seq_file *m, struct pid_namespace *ns,
 	task_show_regs(m, task);
 #endif
 	task_context_switch_counts(m, task);
+	task_checkpoint_status(m, task);
 	return 0;
 }
 
diff --git a/include/linux/checkpoint.h b/include/linux/checkpoint.h
index 6c31c1b..0e90b67 100644
--- a/include/linux/checkpoint.h
+++ b/include/linux/checkpoint.h
@@ -123,6 +123,8 @@ static inline int cr_enabled(void)
 	return 1;
 }
 
+extern void task_checkpoint_status(struct seq_file *m, struct task_struct *p);
+
 #else /* !CONFIG_CHECKPOINT_RESTART */
 
 static inline void files_deny_checkpointing(struct files_struct *files) {}
@@ -143,5 +145,7 @@ static inline int cr_enabled(void)
 	return 0;
 }
 
+static inline void task_checkpoint_status(struct seq_file *m,
+			struct task_struct *p) {}
 #endif /* CONFIG_CHECKPOINT_RESTART */
 #endif /* _CHECKPOINT_CKPT_H_ */
-- 
1.5.4.3

  reply	other threads:[~2009-03-06 19:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-06 19:59 [PATCH 1/3] cr: move CR_BAD_VM_FLAGS to header file Serge E. Hallyn
2009-03-06 19:59 ` Serge E. Hallyn [this message]
     [not found] ` <20090306195911.GA9512-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-03-06 20:00   ` [PATCH 3/3] cr: track mm checkpointability Serge E. Hallyn
2009-03-06 20:00     ` Serge E. Hallyn

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=20090306195937.GA9632@us.ibm.com \
    --to=serue@us.ibm.com \
    --cc=adobriyan@gmail.com \
    --cc=clg@fr.ibm.com \
    --cc=containers@lists.osdl.org \
    --cc=haveblue@us.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.