+ task-watchers-register-per-task-semundo-watcher.patch added to -mm tree

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

 



The patch titled

     Task watchers: register per-task semundo watcher

has been added to the -mm tree.  Its filename is

     task-watchers-register-per-task-semundo-watcher.patch

See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find
out what to do about this

------------------------------------------------------
Subject: Task watchers: register per-task semundo watcher
From: Matt Helsley <matthltc@xxxxxxxxxx>


This patch switches semundo from using the global task_watchers notifier chain
to a per-task notifier chain.  In the case where a task does not use SysV
semaphores this would save a call to exit_sem().

Based off Jes Sorensen's patch implementing this with task_notifiers.

Signed-off-by: Matt Helsley <matthltc@xxxxxxxxxx>
Cc: Jes Sorensen <jes@xxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxx>
---

 ipc/sem.c |   23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

diff -puN ipc/sem.c~task-watchers-register-per-task-semundo-watcher ipc/sem.c
--- a/ipc/sem.c~task-watchers-register-per-task-semundo-watcher
+++ a/ipc/sem.c
@@ -141,10 +141,6 @@ static int sem_undo_task_exit(struct not
 	}
 }
 
-static struct notifier_block sem_watch_tasks_nb = {
-	.notifier_call = sem_undo_task_exit
-};
-
 static void __ipc_init __sem_init_ns(struct ipc_namespace *ns, struct ipc_ids *ids)
 {
 	ns->ids[IPC_SEM_IDS] = ids;
@@ -195,7 +191,6 @@ void __init sem_init (void)
 	ipc_init_proc_interface("sysvipc/sem",
 				"       key      semid perms      nsems   uid   gid  cuid  cgid      otime      ctime\n",
 				IPC_SEM_IDS, sysvipc_sem_proc_show);
-	register_task_watcher(&sem_watch_tasks_nb);
 }
 
 /*
@@ -1012,7 +1007,6 @@ static inline void unlock_semundo(void)
 		spin_unlock(&undo_list->lock);
 }
 
-
 /* If the task doesn't already have a undo_list, then allocate one
  * here.  We guarantee there is only one thread using this undo list,
  * and current is THE ONE
@@ -1028,13 +1022,24 @@ static inline int get_undo_list(struct s
 {
 	struct sem_undo_list *undo_list;
 	int size;
+	struct notifier_block *semun_nb;
+	int retval;
 
 	undo_list = current->sysvsem.undo_list;
 	if (!undo_list) {
+		semun_nb = NULL;
+		retval = -ENOMEM;
 		size = sizeof(struct sem_undo_list);
 		undo_list = (struct sem_undo_list *) kmalloc(size, GFP_KERNEL);
 		if (undo_list == NULL)
-			return -ENOMEM;
+			goto err;
+		semun_nb = kzalloc(sizeof(*semun_nb), GFP_KERNEL);
+		if (semun_nb == NULL)
+			goto err;
+		semun_nb->notifier_call = sem_undo_task_exit;
+		retval = register_per_task_watcher(semun_nb);
+		if (retval)
+			goto err;
 		memset(undo_list, 0, size);
 		spin_lock_init(&undo_list->lock);
 		atomic_set(&undo_list->refcnt, 1);
@@ -1042,6 +1047,10 @@ static inline int get_undo_list(struct s
 	}
 	*undo_listp = undo_list;
 	return 0;
+err:
+	kfree(semun_nb);
+	kfree(undo_list);
+	return retval;
 }
 
 static struct sem_undo *lookup_undo(struct sem_undo_list *ulp, int semid)
_

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

process-events-header-cleanup.patch
process-events-license-change.patch
remove-unecessary-null-check-in-kernel-acctc.patch
mark-profile-notifier-blocks-__read_mostly.patch
task-watchers-task-watchers.patch
task-watchers-task-watchers-tidy.patch
task-watchers-register-process-events-task-watcher.patch
task-watchers-refactor-process-events.patch
task-watchers-make-process-events-configurable-as.patch
task-watchers-allow-task-watchers-to-block.patch
task-watchers-register-audit-task-watcher.patch
task-watchers-register-per-task-delay-accounting.patch
task-watchers-register-profile-as-a-task-watcher.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