mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@tv-sign.ru>
To: Michael Kerrisk <mtk.manpages@googlemail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	lkml <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Bart Van Assche <bart.vanassche@gmail.com>,
	Roland McGrath <roland@redhat.com>
Subject: Re: [patch] make siginfo_t si_utime + si_sstime report times in USER_HZ, not HZ
Date: Fri, 27 Jun 2008 20:33:33 +0400	[thread overview]
Message-ID: <20080627163333.GB508@tv-sign.ru> (raw)
In-Reply-To: <cfd18e0f0806270106s5088327dja804c973bee117d@mail.gmail.com>

On 06/27, Michael Kerrisk wrote:
>
> On Thu, Jun 26, 2008 at 5:09 PM, Michael Kerrisk
> <mtk.manpages@googlemail.com> wrote:
> > On Wed, Jun 25, 2008 at 5:38 PM, Oleg Nesterov <oleg@tv-sign.ru> wrote:
> >> On 06/25, Michael Kerrisk wrote:
> >>>
> >>> --- /home/mtk/ARCHIVE/KERNEL/linux-2.6.26-rc7/kernel/signal.c.orig    2008-06-24
> >>> 16:20:39.000000000 +0200
> >>> +++ /home/mtk/ARCHIVE/KERNEL/linux-2.6.26-rc7/kernel/signal.c 2008-06-24
> >>> 16:22:17.000000000 +0200
> >>> @@ -1379,10 +1379,9 @@
> >>>
> >>>       info.si_uid = tsk->uid;
> >>>
> >>> -     /* FIXME: find out whether or not this is supposed to be c*time. */
> >>> -     info.si_utime = cputime_to_jiffies(cputime_add(tsk->utime,
> >>> +     info.si_utime = cputime_to_clock_t(cputime_add(tsk->utime,
> >>>                                                      tsk->signal->utime));
> >>> -     info.si_stime = cputime_to_jiffies(cputime_add(tsk->stime,
> >>> +     info.si_stime = cputime_to_clock_t(cputime_add(tsk->stime,
> >>>                                                      tsk->signal->stime));
> >>>
> >>>       info.si_status = tsk->exit_code & 0x7f;
> >>> @@ -1450,9 +1449,8 @@
> >>>
> >>>       info.si_uid = tsk->uid;
> >>>
> >>> -     /* FIXME: find out whether or not this is supposed to be c*time. */
> >>> -     info.si_utime = cputime_to_jiffies(tsk->utime);
> >>> -     info.si_stime = cputime_to_jiffies(tsk->stime);
> >>> +     info.si_utime = cputime_to_clock_t(tsk->utime);
> >>> +     info.si_stime = cputime_to_clock_t(tsk->stime);
> >>>
> >>>       info.si_code = why;
> >>>       switch (why) {
> >>
> >> This looks like the obviously good fix to me.
> >
> > Tested now, and it does what I expect.
> >
> >> The patch also deletes the comment about signal_struct->cXtime,
> >> this also looks right: why should we use cutime/cstime ?
> >
> > Hmmm -- maybe I was wrong to delete that comment.  I think the point
> > of the comment was: should the time returned vie these fields of the
> > signinfo structure also include the times for (grand)children of the
> > process that had terminated and been wait()ed for.  My first take on
> > that was "no".  But now I'm not 100% sure.  A quick test on Solaris 8
> > suggests that these fields *do* include the times of waited for
> > children.  (None of this is specified in POSIX.1, which doesn't
> > specify si_utime and si_stime.)  I've not yet tested FreeBSD (not sure
> > if it supports these fields or not).
> 
> So, FreeBSD doesn't implement these fields.  A more extensive test
> (see below) on Solaris (8) shows that it does indeed include the times
> of waited-for children in the si_utime and si_stime fields.
> 
> I'm not sure if we should emulate that behavior or not - it'd be easy
> enough to do so of course.  Thoughts, anyone?

Well, I don't know. But since POSIX says nothing, perhaps there is
no reason to change the historical behaviour?

Anyway, I think you were right to kill this comment, it is very old
(from 2.4.26 at least), and confusing. It looks as if it suggests
to use signal->cXtime _instead_ of utime/stime.


Hmm. do_notify_parent_cldstop() only uses tsk->xtime even if we report
CLD_STOPPED, but tsk is the "random" thread which does finish_stop().
I don't know what is the supposed behaviour in that case... but unlikely
we should use signal->cXtime, another reason to kill the comment ;)

Oleg.


  reply	other threads:[~2008-06-27 16:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-25 14:49 Michael Kerrisk
2008-06-25 15:38 ` Oleg Nesterov
2008-06-25 20:26   ` Roland McGrath
2008-06-26 15:09   ` Michael Kerrisk
2008-06-27  8:06     ` Michael Kerrisk
2008-06-27 16:33       ` Oleg Nesterov [this message]
2008-06-27 20:27         ` Roland McGrath

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=20080627163333.GB508@tv-sign.ru \
    --to=oleg@tv-sign.ru \
    --cc=akpm@linux-foundation.org \
    --cc=bart.vanassche@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mtk.manpages@googlemail.com \
    --cc=roland@redhat.com \
    --cc=tglx@linutronix.de \
    /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®