- task-watchers-add-support-for-per-task-watchers.patch removed from -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled

     Task watchers: add support for per-task watchers

has been removed from the -mm tree.  Its filename is

     task-watchers-add-support-for-per-task-watchers.patch

This patch was dropped because it was nacked by the maintainer

------------------------------------------------------
Subject: Task watchers: add support for per-task watchers
From: Matt Helsley <matthltc@xxxxxxxxxx>

This introduces a second, per-task, blocking notifier chain.  The per-task
chain offers watchers the chance to register with a specific task nstead of
all tasks.  It also allows the watcher to associate a block of data with the
task by wrapping the notifier block using containerof().

Both the global, all-tasks chain and the per-task chain are called from the
same function.  The two types of chains share the same set of notification
values, however registration functions and the registered notifier blocks must
be separate.

These notifiers are only safe if notifier blocks are registered with the
current task while in the context of the current task.  This ensures that
there are no races between registration, unregistration, and notification.

Signed-off-by: Matt Helsley <matthltc@xxxxxxxxxx>
Cc: Jes Sorensen <jes@xxxxxxx>
Cc: Chandra S. Seetharaman <sekharan@xxxxxxxxxx>
Cc: Alan Stern <stern@xxxxxxxxxxxxxxxxxxx>
DESC
task-watchers-add-support-for-per-task-watchers-warning-fix
EDESC

Needs fixing for real.

Cc: Matt Helsley <matthltc@xxxxxxxxxx>
Cc: Jes Sorensen <jes@xxxxxxx>
Cc: Chandra S. Seetharaman <sekharan@xxxxxxxxxx>
Cc: Alan Stern <stern@xxxxxxxxxxxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxx>
---

 include/linux/init_task.h |    2 ++
 include/linux/notifier.h  |    2 ++
 include/linux/sched.h     |    2 ++
 kernel/sys.c              |   31 ++++++++++++++++++++++++++++++-
 4 files changed, 36 insertions(+), 1 deletion(-)

diff -puN include/linux/init_task.h~task-watchers-add-support-for-per-task-watchers include/linux/init_task.h
--- a/include/linux/init_task.h~task-watchers-add-support-for-per-task-watchers
+++ a/include/linux/init_task.h
@@ -5,6 +5,7 @@
 #include <linux/rcupdate.h>
 #include <linux/irqflags.h>
 #include <linux/lockdep.h>
+#include <linux/notifier.h>
 
 #define INIT_FDTABLE \
 {							\
@@ -128,6 +129,7 @@ extern struct group_info init_groups;
 	.pi_lock	= SPIN_LOCK_UNLOCKED,				\
 	INIT_TRACE_IRQFLAGS						\
 	INIT_LOCKDEP							\
+	.notify		= RAW_NOTIFIER_INIT(tsk.notify),		\
 }
 
 
diff -puN include/linux/notifier.h~task-watchers-add-support-for-per-task-watchers include/linux/notifier.h
--- a/include/linux/notifier.h~task-watchers-add-support-for-per-task-watchers
+++ a/include/linux/notifier.h
@@ -156,6 +156,8 @@ extern int raw_notifier_call_chain(struc
 
 extern int register_task_watcher(struct notifier_block *nb);
 extern int unregister_task_watcher(struct notifier_block *nb);
+extern int register_per_task_watcher(struct notifier_block *nb);
+extern int unregister_per_task_watcher(struct notifier_block *nb);
 #define WATCH_FLAGS_MASK		((-1) ^ 0x0FFFFUL)
 #define get_watch_event(v)		({ ((v) & ~WATCH_FLAGS_MASK); })
 #define get_watch_flags(v) 		({ ((v) & WATCH_FLAGS_MASK); })
diff -puN include/linux/sched.h~task-watchers-add-support-for-per-task-watchers include/linux/sched.h
--- a/include/linux/sched.h~task-watchers-add-support-for-per-task-watchers
+++ a/include/linux/sched.h
@@ -999,6 +999,8 @@ struct task_struct {
 	atomic_t fs_excl;	/* holding fs exclusive resources */
 	struct rcu_head rcu;
 
+	struct raw_notifier_head notify; /* generic per-task notifications */
+
 	/*
 	 * cache last used pipe for splice
 	 */
diff -puN kernel/sys.c~task-watchers-add-support-for-per-task-watchers kernel/sys.c
--- a/kernel/sys.c~task-watchers-add-support-for-per-task-watchers
+++ a/kernel/sys.c
@@ -448,9 +448,38 @@ int unregister_task_watcher(struct notif
 }
 EXPORT_SYMBOL_GPL(unregister_task_watcher);
 
+static inline int notify_per_task_watchers(unsigned int val,
+					   struct task_struct *task)
+{
+	if (get_watch_event(val) != WATCH_TASK_INIT)
+		return raw_notifier_call_chain(&task->notify, val, task);
+	RAW_INIT_NOTIFIER_HEAD(&task->notify);
+	if (task->real_parent)
+		return raw_notifier_call_chain(&task->real_parent->notify,
+		   			       val, task);
+	return 0;
+}
+
+int register_per_task_watcher(struct notifier_block *nb)
+{
+	return raw_notifier_chain_register(&current->notify, nb);
+}
+EXPORT_SYMBOL_GPL(register_per_task_watcher);
+
+int unregister_per_task_watcher(struct notifier_block *nb)
+{
+	return raw_notifier_chain_unregister(&current->notify, nb);
+}
+EXPORT_SYMBOL_GPL(unregister_per_task_watcher);
+
 int notify_watchers(unsigned long val, void *v)
 {
-	return blocking_notifier_call_chain(&task_watchers, val, v);
+	int retval;
+
+	retval = blocking_notifier_call_chain(&task_watchers, val, v);
+	if (retval & NOTIFY_STOP_MASK)
+		return retval;
+	return notify_per_task_watchers(val, v);
 }
 
 static int set_one_prio(struct task_struct *p, int niceval, int error)
_

Patches currently in -mm which might be from matthltc@xxxxxxxxxx are

kernel-bug-fixing-for-kernel-kmodc.patch
task-watchers-add-support-for-per-task-watchers.patch
task-watchers-register-semundo-task-watcher.patch
task-watchers-register-per-task-semundo-watcher.patch
ipc-replace-kmalloc-and-memset-in-get_undo_list-with-kzalloc.patch

-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux