public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Fredrik Markstrom <fredrik.markstrom@gmail.com>
Cc: mingo@redhat.com, linux-kernel@vger.kernel.org,
	Rik van Riel <riel@redhat.com>
Subject: Re: [PATCH 1/1] cputime: Make the reported utime+stime correspond to the actual runtime.
Date: Fri, 12 Jun 2015 13:01:58 +0200	[thread overview]
Message-ID: <20150612110158.GA18673@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <1434104217.1495.74.camel@twins>

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;
 	}
 

  reply	other threads:[~2015-06-12 11:02 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-12  8:55 [PATCH 0/1] cputime: Make the reported utime+stime correspond to the actual runtime Fredrik Markstrom
2015-06-12  8:55 ` [PATCH 1/1] " Fredrik Markstrom
2015-06-12 10:16   ` Peter Zijlstra
2015-06-12 11:01     ` Peter Zijlstra [this message]
2015-06-15 15:34       ` Fredrik Markström
2015-06-16 14:35         ` Fredrik Markström
2015-06-29 14:58         ` Peter Zijlstra
2015-06-29 15:28           ` Fredrik Markström
2015-06-29 18:54             ` Jason Low
2015-06-29 19:08               ` Fredrik Markström
2015-06-29 22:11                 ` Jason Low
2015-06-30  9:30             ` Peter Zijlstra
2015-06-30 11:50               ` Fredrik Markström
2015-06-30 12:18                 ` Peter Zijlstra
2015-06-30 18:30                   ` Fredrik Markström
2015-07-02 12:11                     ` Peter Zijlstra
2015-07-02 13:07                       ` Peter Zijlstra
2015-07-07  0:51                         ` Frederic Weisbecker
2015-07-07  7:59                           ` Peter Zijlstra
2015-07-07  8:09                             ` Peter Zijlstra
2015-07-07 12:10                               ` Fredrik Markström
2015-07-07 15:37                                 ` Peter Zijlstra
2015-07-07 13:34                               ` Frederic Weisbecker
2015-07-07 15:34                                 ` Peter Zijlstra
2015-07-07 16:26                                   ` Frederic Weisbecker
2015-06-13 11:17     ` Fredrik Markström

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=20150612110158.GA18673@twins.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=fredrik.markstrom@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=riel@redhat.com \
    /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