From: Guillaume Chazarain <guichaz@yahoo.fr>
To: Oleg Nesterov <oleg@tv-sign.ru>
Cc: akpm@linux-foundation.org,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
balbir@in.ibm.com, jlan@engr.sgi.com, jlim@sgi.com
Subject: Re: + taskstats-add-all-thread-stats-for-taskstats_cmd_attr_tgid.patch added to -mm tree
Date: Sat, 15 Sep 2007 20:51:24 +0200 [thread overview]
Message-ID: <20070915205124.4ccac9a9@localhost.localdomain> (raw)
In-Reply-To: <20070913124141.GA2673@tv-sign.ru>
Le Thu, 13 Sep 2007 16:41:41 +0400,
Oleg Nesterov <oleg@tv-sign.ru> a écrit :
> (sorry, have no time to read the patch carefully, just a couple of
> minor random "unless I misread this patch" nits)
Thank you Oleg, hopefully I addressed all your comments in v4.
> > + do
> > + if (!tsk->exit_state)
> > + add_tsk(stats, tsk);
> > + while_each_thread(first, tsk);
>
> This reminds me. The "!tsk->exit_state" is not good and racy, it
> can't prevent the double accounting (of course, I don't blame this
> patch).
I documented this in v4, but I was wondering if always setting
tsk->exit_state under the protection of lock_task_sighand() would fix
the race.
> > + if (thread_group_leader(task)) {
> > + stats->ac_exitcode = task->exit_code;
> > + if (task->flags & PF_FORKNOEXEC)
> > stats->ac_flag |= AFORK;
>
> Actually, I can't understand this "thread_group_leader()" check, but
Seems like this code was copied from kernel/acct.c:acct_collect():
if (thread_group_leader(current)) {
pacct->ac_exitcode = exitcode;
if (current->flags & PF_FORKNOEXEC)
pacct->ac_flag |= AFORK;
}
> I don't know what ->ac_exitcode and AFORK means to the user-space.
>From include/linux/acct.h: executed fork, but did not exec
Except that it talks about fork(2), not do_fork() hence the
thread_group_leader() test to avoid flagging threads.
> But it looks a bit suspicious. Perhaps we need
> ->signal->group_exit_code, not task->exit_code?
I put ->signal->group_exit_code if not null, otherwise
leader->exit_code.
Thank again to you and Andrew for the review.
--
Guillaume
next parent reply other threads:[~2007-09-15 18:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <200709130018.l8D0IgHl026136@imap1.linux-foundation.org>
[not found] ` <20070913124141.GA2673@tv-sign.ru>
2007-09-15 18:51 ` Guillaume Chazarain [this message]
2007-09-17 16:26 ` Oleg Nesterov
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=20070915205124.4ccac9a9@localhost.localdomain \
--to=guichaz@yahoo.fr \
--cc=akpm@linux-foundation.org \
--cc=balbir@in.ibm.com \
--cc=jlan@engr.sgi.com \
--cc=jlim@sgi.com \
--cc=linux-kernel@vger.kernel.org \
--cc=oleg@tv-sign.ru \
/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
all inboxes | Powered by JetHome®