mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [patch] make siginfo_t si_utime + si_sstime report times in USER_HZ, not HZ
@ 2008-06-25 14:49 Michael Kerrisk
  2008-06-25 15:38 ` Oleg Nesterov
  0 siblings, 1 reply; 7+ messages in thread
From: Michael Kerrisk @ 2008-06-25 14:49 UTC (permalink / raw)
  To: Thomas Gleixner, Oleg Nesterov; +Cc: lkml, Andrew Morton, Bart Van Assche

Oleg, Thomas,

In the switch to configurable HZ in 2.6, the treatment of the si_utime
and si_stime fields that are exposed to userland via the siginfo
structure looks to have been botched.  As things stand, these fields
report times in units of HZ, so that userland gets information that
varies depending on the HZ that the kernel was configured with.  This
(trivial, untested) patch changes the reported values to use USER_HZ
units.  What do you think of making this change?

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>

--- /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) {

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2008-06-27 20:52 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-06-25 14:49 [patch] make siginfo_t si_utime + si_sstime report times in USER_HZ, not HZ 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
2008-06-27 20:27         ` Roland McGrath

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®