diff options
author | Roland McGrath <roland@redhat.com> | 2006-04-11 01:54:16 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-04-11 09:18:42 -0400 |
commit | f5e902817fee1589badca1284f49eecc0ef0c200 (patch) | |
tree | c72c0b9ae52c81ccecbd434fb886f8f668245f74 | |
parent | 491d4bed8051c655c7664b85446e13901463eb63 (diff) |
[PATCH] process accounting: take original leader's start_time in non-leader exec
The only record we have of the real-time age of a process, regardless of
execs it's done, is start_time. When a non-leader thread exec, the
original start_time of the process is lost. Things looking at the
real-time age of the process are fooled, for example the process accounting
record when the process finally dies. This change makes the oldest
start_time stick around with the process after a non-leader exec. This way
the association between PID and start_time is kept constant, which seems
correct to me.
Signed-off-by: Roland McGrath <roland@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | fs/exec.c | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -678,6 +678,18 @@ static int de_thread(struct task_struct *tsk) | |||
678 | while (leader->exit_state != EXIT_ZOMBIE) | 678 | while (leader->exit_state != EXIT_ZOMBIE) |
679 | yield(); | 679 | yield(); |
680 | 680 | ||
681 | /* | ||
682 | * The only record we have of the real-time age of a | ||
683 | * process, regardless of execs it's done, is start_time. | ||
684 | * All the past CPU time is accumulated in signal_struct | ||
685 | * from sister threads now dead. But in this non-leader | ||
686 | * exec, nothing survives from the original leader thread, | ||
687 | * whose birth marks the true age of this process now. | ||
688 | * When we take on its identity by switching to its PID, we | ||
689 | * also take its birthdate (always earlier than our own). | ||
690 | */ | ||
691 | current->start_time = leader->start_time; | ||
692 | |||
681 | spin_lock(&leader->proc_lock); | 693 | spin_lock(&leader->proc_lock); |
682 | spin_lock(¤t->proc_lock); | 694 | spin_lock(¤t->proc_lock); |
683 | proc_dentry1 = proc_pid_unhash(current); | 695 | proc_dentry1 = proc_pid_unhash(current); |