[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090306195937.GA9632@us.ibm.com>
Date: Fri, 6 Mar 2009 13:59:37 -0600
From: "Serge E. Hallyn" <serue@...ibm.com>
To: Dave Hansen <haveblue@...ibm.com>, Ingo Molnar <mingo@...e.hu>,
Oren Laadan <orenl@...columbia.edu>,
Alexey Dobriyan <adobriyan@...il.com>,
Cedric Le Goater <clg@...ibm.com>
Cc: lkml <linux-kernel@...r.kernel.org>,
Linux Containers <containers@...ts.osdl.org>
Subject: [PATCH 2/3] cr: add file checkpointability to /proc/pid/status
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@...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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists