lkml.org 
[lkml]   [2015]   [Jun]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH 1/1] cputime: Make the reported utime+stime correspond to the actual runtime.
On Fri, Jun 12, 2015 at 12:16:57PM +0200, Peter Zijlstra wrote:
> On Fri, 2015-06-12 at 10:55 +0200, Fredrik Markstrom wrote:
> > The scaling mechanism might sometimes cause top to report >100%
> > (sometimes > 1000%) cpu usage for a single thread. This patch makes
> > sure that stime+utime corresponds to the actual runtime of the thread.
>
> This Changelog is inadequate, it does not explain the actual problem.
>
> > +static DEFINE_SPINLOCK(prev_time_lock);
>
> global (spin)locks are bad.

Since you have a proglet handy to test this; does something like the
below help anything?

---
kernel/sched/cputime.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/kernel/sched/cputime.c b/kernel/sched/cputime.c
index f5a64ffad176..3d3f60a555a0 100644
--- a/kernel/sched/cputime.c
+++ b/kernel/sched/cputime.c
@@ -613,6 +613,10 @@ static void cputime_adjust(struct task_cputime *curr,

stime = scale_stime((__force u64)stime,
(__force u64)rtime, (__force u64)total);
+
+ if (stime < prev->stime)
+ stime = prev->stime;
+
utime = rtime - stime;
}


\
 
 \ /
  Last update: 2015-06-12 13:21    [W:0.150 / U:0.048 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site