linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] TASK_KILLABLE version 2
@ 2007-09-02  2:43 Matthew Wilcox
  2007-09-02  2:46 ` [PATCH 1/5] Use wake_up_locked() in eventpoll Matthew Wilcox
                   ` (5 more replies)
  0 siblings, 6 replies; 23+ messages in thread
From: Matthew Wilcox @ 2007-09-02  2:43 UTC (permalink / raw)
  To: Andrew Morton, Linus Torvalds; +Cc: linux-kernel


Here's the second version of TASK_KILLABLE.  A few changes since version 1:

 - Don't split up TASK_INTERRUPTIBLE and TASK_UNINTERRUPTIBLE.
   TASK_WAKESIGNAL and TASK_LOADAVG were pretty much equivalent, and since
   we had to keep __TASK_{UN,}INTERRUPTIBLE anyway, splitting them made
   little sense.
 - Instead, I've added some is_task_*() predicates.  I think they
   achieve what Linus wanted without consuming flag bits and without
   checking a metric tonne of code to see whether it wanted
   TASK_UNINTERRUPTIBLE or __TASK_UNINTERRUPTIBLE.
 - Renamed try_lock_page() to lock_page_killable() and change the sense.
   I had envisioned uses being like spin_trylock(), but that turned out
   not to make sense.
 - Fix the bug Trond noticed in wait_on_retry_sync_kiocb() by having the
   callers handle it returning -EINTR
 - Fix the bug I noticed in sync_pages_killable() by adding the new
   function fatal_signal_pending()
 - Audit a lot of uses of TASK_*.  A few seemed dubious and were fixed.

I'd like to see this spend a bit of time in the -mm tree.  I've wasted
a couple of days trying to track down why my machine no longer does
much after starting init, so clearly I'm tampering with stuff I don't
quite understand.

Having said that, I ditched that version of the code and started again
with a much more minimalist approach.  I've also split the patch into
five independent pieces, each of which accomplishes a logical step,
for ease of bisection.

I think patch 1/5 is clearly Right and should be merged ASAP.  Patch 2/5
and 3/5 carry some risk.  4/5 and 5/5 seem less risky to me (and are
independent of each other; both rely on 1-3 being applied first)

I obviously haven't covered every place that can result in a process
sleeping uninterruptibly while attempting an operation.  But sync_page
(patch 4/5) covers about 90% of the times I've attempted to kill cat,
and I hope that by providing the two examples, I can help other people
to fix the cases that they find interesting.

-- 
Intel are signing my paycheques ... these opinions are still mine
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours.  We can't possibly take such
a retrograde step."

^ permalink raw reply	[flat|nested] 23+ messages in thread
* [PATCH 0/5] TASK_KILLABLE
@ 2007-10-18 22:25 Matthew Wilcox
  2007-10-18 22:25 ` [PATCH 2/5] Use macros instead of TASK_ flags Matthew Wilcox
  0 siblings, 1 reply; 23+ messages in thread
From: Matthew Wilcox @ 2007-10-18 22:25 UTC (permalink / raw)
  To: linux-kernel; +Cc: Matthew Wilcox

This series of patches introduces the facility to deliver only fatal
signals to tasks which are otherwise waiting uninterruptibly.

^ permalink raw reply	[flat|nested] 23+ messages in thread
* [PATCH 1/5] Use wake_up_locked() in eventpoll
@ 2007-10-24 12:24 Matthew Wilcox
  2007-10-24 12:24 ` [PATCH 2/5] Use macros instead of TASK_ flags Matthew Wilcox
  0 siblings, 1 reply; 23+ messages in thread
From: Matthew Wilcox @ 2007-10-24 12:24 UTC (permalink / raw)
  To: torvalds, akpm, linux-kernel; +Cc: Matthew Wilcox, Matthew Wilcox

Replace the uses of __wake_up_locked with wake_up_locked

Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
---
 fs/eventpoll.c |   11 ++++-------
 1 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/fs/eventpoll.c b/fs/eventpoll.c
index 34f68f3..81c04ab 100644
--- a/fs/eventpoll.c
+++ b/fs/eventpoll.c
@@ -656,8 +656,7 @@ is_linked:
 	 * wait list.
 	 */
 	if (waitqueue_active(&ep->wq))
-		__wake_up_locked(&ep->wq, TASK_UNINTERRUPTIBLE |
-				 TASK_INTERRUPTIBLE);
+		wake_up_locked(&ep->wq);
 	if (waitqueue_active(&ep->poll_wait))
 		pwake++;
 
@@ -780,7 +779,7 @@ static int ep_insert(struct eventpoll *ep, struct epoll_event *event,
 
 		/* Notify waiting tasks that events are available */
 		if (waitqueue_active(&ep->wq))
-			__wake_up_locked(&ep->wq, TASK_UNINTERRUPTIBLE | TASK_INTERRUPTIBLE);
+			wake_up_locked(&ep->wq);
 		if (waitqueue_active(&ep->poll_wait))
 			pwake++;
 	}
@@ -854,8 +853,7 @@ static int ep_modify(struct eventpoll *ep, struct epitem *epi, struct epoll_even
 
 			/* Notify waiting tasks that events are available */
 			if (waitqueue_active(&ep->wq))
-				__wake_up_locked(&ep->wq, TASK_UNINTERRUPTIBLE |
-						 TASK_INTERRUPTIBLE);
+				wake_up_locked(&ep->wq);
 			if (waitqueue_active(&ep->poll_wait))
 				pwake++;
 		}
@@ -978,8 +976,7 @@ errxit:
 		 * wait list (delayed after we release the lock).
 		 */
 		if (waitqueue_active(&ep->wq))
-			__wake_up_locked(&ep->wq, TASK_UNINTERRUPTIBLE |
-					 TASK_INTERRUPTIBLE);
+			wake_up_locked(&ep->wq);
 		if (waitqueue_active(&ep->poll_wait))
 			pwake++;
 	}
-- 
1.4.4.2


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

end of thread, other threads:[~2007-12-07  1:49 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-09-02  2:43 [PATCH] TASK_KILLABLE version 2 Matthew Wilcox
2007-09-02  2:46 ` [PATCH 1/5] Use wake_up_locked() in eventpoll Matthew Wilcox
2007-09-02  2:46 ` [PATCH 2/5] Use macros instead of TASK_ flags Matthew Wilcox
2007-09-02  2:54   ` Matthew Wilcox
2007-09-02  3:35   ` Daniel Walker
2007-09-02  4:05     ` Matthew Wilcox
2007-09-03 21:03   ` Matthew Wilcox
2007-09-02  2:46 ` [PATCH 3/5] Add TASK_WAKEKILL Matthew Wilcox
2007-09-02  2:46 ` [PATCH 4/5] Add lock_page_killable Matthew Wilcox
2007-09-02  2:46 ` [PATCH 5/5] Make wait_on_retry_sync_kiocb killable Matthew Wilcox
2007-09-24 20:16 ` [PATCH] TASK_KILLABLE version 2 Bob Bell
2007-09-26 11:57   ` Ric Wheeler
2007-09-27 21:47     ` Nick Piggin
2007-12-07  1:49   ` Matthew Wilcox
2007-10-18 22:25 [PATCH 0/5] TASK_KILLABLE Matthew Wilcox
2007-10-18 22:25 ` [PATCH 2/5] Use macros instead of TASK_ flags Matthew Wilcox
2007-10-25  3:50   ` Nick Piggin
2007-10-24 12:24 [PATCH 1/5] Use wake_up_locked() in eventpoll Matthew Wilcox
2007-10-24 12:24 ` [PATCH 2/5] Use macros instead of TASK_ flags Matthew Wilcox
2007-10-25  3:31   ` Andrew Morton
2007-10-26 18:45   ` Andrew Morton
2007-10-26 20:39     ` Alexey Dobriyan
2007-10-27  0:33       ` Matthew Wilcox
2007-12-05 12:56   ` Ingo Molnar
2007-12-06 14:42     ` Matthew Wilcox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).