[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20101214154504.7037c2c0@suzukikp>
Date: Tue, 14 Dec 2010 15:45:04 +0530
From: "Suzuki K. Poulose" <suzuki@...ibm.com>
To: linux-kernel@...r.kernel.org
Cc: "Suzuki K. Poulose" <suzuki@...ibm.com>,
Jeremy Fitzhardinge <jeremy.fitzhardinge@...rix.com>,
Christoph Hellwig <hch@....de>,
Masami Hiramatsu <mhiramat@...hat.com>,
Ananth N Mavinakayanahalli <ananth@...ibm.com>,
Daisuke HATAYAMA <d.hatayama@...fujitsu.com>,
Andi Kleen <andi@...stfloor.org>,
Roland McGrath <roland@...hat.com>,
Amerigo Wang <amwang@...hat.com>,
Linus Torvalds <torvalds@...ux-foundation.org>,
KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>,
KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>,
Oleg Nesterov <oleg@...hat.com>,
Andrew Morton <akpm@...ux-foundation.org>
Subject: [Patch 13/21] Freeze / Thaw threads
All the threads in the target process are issued a freeze request on an "open()".
They are woken up when we release the fd.
Signed-off-by: Suzuki K. Poulose <suzuki@...ibm.com>
Signed-off-by: Ananth N.Mavinakayanahalli <ananth@...ibm.com>
---
fs/proc/gencore.c | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
Index: linux-2.6.36-rc7/fs/proc/gencore.c
===================================================================
--- linux-2.6.36-rc7.orig/fs/proc/gencore.c
+++ linux-2.6.36-rc7/fs/proc/gencore.c
@@ -24,6 +24,7 @@
#include <linux/seq_file.h>
#include <linux/elf.h>
+#include <linux/freezer.h>
#include "internal.h"
#include "gencore.h"
@@ -70,11 +71,20 @@ out:
static int release_gencore(struct inode *inode, struct file *file)
{
struct task_struct *task = get_proc_task(file->f_dentry->d_inode);
+ struct task_struct *t;
struct core_proc *cp;
if (!task)
return -EIO;
+ /* Thaw all frozen threads */
+ t = task;
+ read_lock(&tasklist_lock);
+ do {
+ thaw_process(t);
+ } while ((t = next_thread(t)) != task);
+ read_unlock(&tasklist_lock);
+
mutex_lock(&core_mutex);
cp = get_core_proc(task);
if (cp) {
@@ -117,6 +127,7 @@ static int get_elf_class(struct task_str
static int open_gencore(struct inode *inode, struct file *filp)
{
struct task_struct *task = get_proc_task(inode);
+ struct task_struct *t;
struct core_proc *cp;
int ret = 0;
int elf_class;
@@ -148,6 +159,21 @@ static int open_gencore(struct inode *in
list_add(&cp->list, &core_list);
mutex_unlock(&core_mutex);
+ /* freeze the processes */
+ t = task;
+ read_lock(&tasklist_lock);
+ do {
+ if (frozen(t) || !freezeable(t) || freezing(t))
+ continue;
+
+ if (freeze_task(t, true))
+ continue;
+
+ if (task_is_stopped_or_traced(t))
+ continue;
+ } while ((t = next_thread(t)) != task);
+ read_unlock(&tasklist_lock);
+
out:
put_task_struct(task);
return ret;
--
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