From: Roland McGrath <roland@redhat.com>
To: KaiGai Kohei <kaigai@ak.jp.nec.com>
Cc: Andrew Morton <akpm@osdl.org>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: Re: Fix pacct bug in multithreading case.
Date: Tue, 4 Apr 2006 02:25:07 -0700 (PDT) [thread overview]
Message-ID: <20060404092507.753721809CE@magilla.sf.frob.com> (raw)
In-Reply-To: KaiGai Kohei's message of Tuesday, 28 March 2006 20:43:49 +0900 <44292175.6030605@ak.jp.nec.com>
That change looks correct to me, and I see that it's gone in.
It made me think of another issue affecting the accounting records in
related circumstances when the old group leader died after a non-leader exec.
I think this patch addresses that, and along with your patch, gives more
sensible times in all cases.
Thanks,
Roland
[PATCH] 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>
---
fs/exec.c | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
7cda52efb6ff969f049bc2ab3742b0341e45184a
diff --git a/fs/exec.c b/fs/exec.c
index 0291a68..a45f712 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -678,6 +678,18 @@ static int de_thread(struct task_struct
while (leader->exit_state != EXIT_ZOMBIE)
yield();
+ /*
+ * The only record we have of the real-time age of a
+ * process, regardless of execs it's done, is start_time.
+ * All the past CPU time is accumulated in signal_struct
+ * from sister threads now dead. But in this non-leader
+ * exec, nothing survives from the original leader thread,
+ * whose birth marks the true age of this process now.
+ * When we take on its identity by switching to its PID, we
+ * also take its birthdate (always earlier than our own).
+ */
+ current->start_time = leader->start_time;
+
spin_lock(&leader->proc_lock);
spin_lock(¤t->proc_lock);
proc_dentry1 = proc_pid_unhash(current);
--
1.2.4
prev parent reply other threads:[~2006-04-04 9:25 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-28 11:43 KaiGai Kohei
2006-04-04 9:25 ` Roland McGrath [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060404092507.753721809CE@magilla.sf.frob.com \
--to=roland@redhat.com \
--cc=akpm@osdl.org \
--cc=kaigai@ak.jp.nec.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome