lkml.org 
[lkml]   [2002]   [Sep]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[patch] exit-fix-2.5.34-C0, BK-curr

the attached patch (ontop of the previous exit.c patches), fixes one more
exit-time resource accounting issue - and it's also a speedup and a
thread-tree (to-be thread-aware pstree) visual improvement.

in the current code we reparent detached threads to the init thread. This
worked but was not very nice in ps output: threads showed up as being
related to init. There was also a resource-accounting issue, upon exit
they update their parent's (ie. init's) rusage fields - effectively losing
these statistics. Eg. 'time' under-reports CPU usage if the threaded app
is Ctrl-C-ed prematurely.

the solution is to reparent threads to the group leader - this is now very
easy since we have p->group_leader cached and it's also valid all the
time. It's also somewhat faster for applications that use CLONE_THREAD but
do not use the CLONE_DETACHED feature.

Ingo

--- linux/kernel/exit.c.orig Sun Sep 15 15:01:48 2002
+++ linux/kernel/exit.c Sun Sep 15 16:23:49 2002
@@ -447,11 +447,7 @@
struct task_struct *p, *reaper = father;
struct list_head *_p;

- if (father->exit_signal != -1)
- reaper = prev_thread(reaper);
- else
- reaper = child_reaper;
-
+ reaper = father->group_leader;
if (reaper == father)
reaper = child_reaper;

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:28    [W:0.029 / U:0.380 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site