The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* PATCH [PPC64]: dead processes never reaped
@ 2005-04-18 19:38 Linas Vepstas
  2005-04-19  1:01 ` Benjamin Herrenschmidt
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Linas Vepstas @ 2005-04-18 19:38 UTC (permalink / raw)
  To: paulus, anton; +Cc: akpm, linuxppc64-dev, linux-kernel



Hi,

The patch below appears to fix a problem where a number of dead processes
linger on the system.  On a highly loaded system, dozens of processes 
were found stuck in do_exit(), calling thier very last schedule(), and
then being lost forever.  

Processes that are PF_DEAD are cleaned up *after* the context switch, 
in a routine called finish_task_switch(task_t *prev). The "prev" gets 
the  value returned by _switch() in entry.S, but this value comes from 
  
__switch_to (struct task_struct *prev, 
            struct task_struct *new) 
{ 
   old_thread = &current->thread; ///XXX shouldn't this be prev, not current? 
   last = _switch(old_thread, new_thread); 
   return last; 
} 
 
The way I see it, "prev" and "current" are almost always going to be  
pointing at the same thing; however, if a "need resched" happens,  
or there's a pre-emept or some-such, then prev and current won't be  
the same; in which case, finish_task_switch() will end up cleaning  
up the old current, instead of prev.  This will result in dead processes 
hanging around, which will never be scheduled again, and will never  
get a chance to have put_task_struct() called on them.  

This patch fixes this.

Signed-off-by: Linas Vepstas <linas@linas.org>


--- arch/ppc64/kernel/process.c.orig	2005-04-18 14:26:42.000000000 -0500
+++ arch/ppc64/kernel/process.c	2005-04-18 14:27:54.000000000 -0500
@@ -204,7 +204,7 @@ struct task_struct *__switch_to(struct t
 	flush_tlb_pending();
 
 	new_thread = &new->thread;
-	old_thread = &current->thread;
+	old_thread = &prev->thread;
 
 	local_irq_save(flags);
 	last = _switch(old_thread, new_thread);

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

end of thread, other threads:[~2005-05-05 21:57 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-04-18 19:38 PATCH [PPC64]: dead processes never reaped Linas Vepstas
2005-04-19  1:01 ` Benjamin Herrenschmidt
2005-04-19 17:39   ` Linas Vepstas
2005-04-19  1:07 ` Benjamin Herrenschmidt
2005-04-19  1:25   ` Nick Piggin
2005-04-19 17:22   ` Linas Vepstas
2005-04-20  5:44 ` Benjamin Herrenschmidt
2005-05-05 21:57   ` Linas Vepstas

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