aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/signal.c
diff options
context:
space:
mode:
authorFrederic Weisbecker <fweisbec@gmail.com>2012-11-13 08:20:55 -0500
committerFrederic Weisbecker <fweisbec@gmail.com>2013-01-27 13:23:31 -0500
commit6fac4829ce0ef9b7f24369086ce5f0e9f38d37bc (patch)
tree44da712b66d778c2fd701f9c96b00e108530e1a9 /kernel/signal.c
parent3f4724ea85b7d9055a9976fa8f30b471bdfbca93 (diff)
cputime: Use accessors to read task cputime stats
This is in preparation for the full dynticks feature. While remotely reading the cputime of a task running in a full dynticks CPU, we'll need to do some extra-computation. This way we can account the time it spent tickless in userspace since its last cputime snapshot. Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Ingo Molnar <mingo@kernel.org> Cc: Li Zhong <zhong@linux.vnet.ibm.com> Cc: Namhyung Kim <namhyung.kim@lge.com> Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Cc: Paul Gortmaker <paul.gortmaker@windriver.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'kernel/signal.c')
-rw-r--r--kernel/signal.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/kernel/signal.c b/kernel/signal.c
index 372771e948c2..776a45a3661b 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -1638,6 +1638,7 @@ bool do_notify_parent(struct task_struct *tsk, int sig)
1638 unsigned long flags; 1638 unsigned long flags;
1639 struct sighand_struct *psig; 1639 struct sighand_struct *psig;
1640 bool autoreap = false; 1640 bool autoreap = false;
1641 cputime_t utime, stime;
1641 1642
1642 BUG_ON(sig == -1); 1643 BUG_ON(sig == -1);
1643 1644
@@ -1675,8 +1676,9 @@ bool do_notify_parent(struct task_struct *tsk, int sig)
1675 task_uid(tsk)); 1676 task_uid(tsk));
1676 rcu_read_unlock(); 1677 rcu_read_unlock();
1677 1678
1678 info.si_utime = cputime_to_clock_t(tsk->utime + tsk->signal->utime); 1679 task_cputime(tsk, &utime, &stime);
1679 info.si_stime = cputime_to_clock_t(tsk->stime + tsk->signal->stime); 1680 info.si_utime = cputime_to_clock_t(utime + tsk->signal->utime);
1681 info.si_stime = cputime_to_clock_t(stime + tsk->signal->stime);
1680 1682
1681 info.si_status = tsk->exit_code & 0x7f; 1683 info.si_status = tsk->exit_code & 0x7f;
1682 if (tsk->exit_code & 0x80) 1684 if (tsk->exit_code & 0x80)
@@ -1740,6 +1742,7 @@ static void do_notify_parent_cldstop(struct task_struct *tsk,
1740 unsigned long flags; 1742 unsigned long flags;
1741 struct task_struct *parent; 1743 struct task_struct *parent;
1742 struct sighand_struct *sighand; 1744 struct sighand_struct *sighand;
1745 cputime_t utime, stime;
1743 1746
1744 if (for_ptracer) { 1747 if (for_ptracer) {
1745 parent = tsk->parent; 1748 parent = tsk->parent;
@@ -1758,8 +1761,9 @@ static void do_notify_parent_cldstop(struct task_struct *tsk,
1758 info.si_uid = from_kuid_munged(task_cred_xxx(parent, user_ns), task_uid(tsk)); 1761 info.si_uid = from_kuid_munged(task_cred_xxx(parent, user_ns), task_uid(tsk));
1759 rcu_read_unlock(); 1762 rcu_read_unlock();
1760 1763
1761 info.si_utime = cputime_to_clock_t(tsk->utime); 1764 task_cputime(tsk, &utime, &stime);
1762 info.si_stime = cputime_to_clock_t(tsk->stime); 1765 info.si_utime = cputime_to_clock_t(utime);
1766 info.si_stime = cputime_to_clock_t(stime);
1763 1767
1764 info.si_code = why; 1768 info.si_code = why;
1765 switch (why) { 1769 switch (why) {