public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] Task notifier against mm: Allow notifier to remove itself
@ 2005-07-29 20:32 Christoph Lameter
  2005-07-29 20:33 ` [PATCH 2/4] Task notifier against mm: Implement todo list in task_struct Christoph Lameter
  0 siblings, 1 reply; 14+ messages in thread
From: Christoph Lameter @ 2005-07-29 20:32 UTC (permalink / raw)
  To: Pavel Machek; +Cc: linux-kernel

Patch for Pavel against 2.6.13-rc3-mm3 (after removal of the TIF_FREEZE 
patch). The same patch was posted yesterday against 2.6.13-rc3. I verified
again that this patch works fine on i386.

---

Allow notifier to remove itself.
This is done by retrieving the pointer to the next notifier from the list before the
notifier call. 

Signed-off-by: Christoph Lameter <christoph@lameter.com>

Index: linux-2.6.13-rc3-mm3/kernel/sys.c
===================================================================
--- linux-2.6.13-rc3-mm3.orig/kernel/sys.c	2005-07-29 10:38:39.000000000 -0700
+++ linux-2.6.13-rc3-mm3/kernel/sys.c	2005-07-29 12:29:18.000000000 -0700
@@ -172,15 +172,18 @@
 {
 	int ret=NOTIFY_DONE;
 	struct notifier_block *nb = *n;
+	struct notifier_block *next;
 
 	while(nb)
 	{
-		ret=nb->notifier_call(nb,val,v);
+		/* Determining next here allows the notifier to unregister itself */
+		next = nb->next;
+		ret = nb->notifier_call(nb,val,v);
 		if(ret&NOTIFY_STOP_MASK)
 		{
 			return ret;
 		}
-		nb=nb->next;
+		nb = next;
 	}
 	return ret;
 }

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2005-08-08 22:09 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-07-29 20:32 [PATCH 1/4] Task notifier against mm: Allow notifier to remove itself Christoph Lameter
2005-07-29 20:33 ` [PATCH 2/4] Task notifier against mm: Implement todo list in task_struct Christoph Lameter
2005-07-29 20:34   ` [PATCH 3/4] Task notifier against mm: Make suspend code SMP safe using todo list Christoph Lameter
2005-07-29 20:35     ` [PATCH 4/4] Task notifier against mm: s/try_to_freeze/try_todo_list in some driver Christoph Lameter
2005-07-30 11:22   ` [PATCH 2/4] Task notifier against mm: Implement todo list in task_struct Pavel Machek
2005-07-30 11:26     ` Pavel Machek
2005-07-30 15:43     ` Christoph Lameter
2005-07-30 16:10       ` Pavel Machek
2005-07-30 16:18         ` Christoph Lameter
2005-07-30 16:22           ` Pavel Machek
2005-08-01 18:43             ` Christoph Lameter
2005-08-08  9:43               ` Pavel Machek
2005-08-08 15:49                 ` Christoph Lameter
2005-08-08 22:09                   ` Pavel Machek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox