public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mike Galbraith <umgwanakikbuti@gmail.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: [patch] sched/cputime: Fix NO_HZ_FULL getrusage() monotonicity regression
Date: Wed, 10 Aug 2016 13:14:29 +0200	[thread overview]
Message-ID: <1470827669.15624.16.camel@gmail.com> (raw)

Hi Peter,

While running ltp, the fates decided it was time for me to encounter
the roughly 1 out of every 10 call failure below.  As much as I run
ltp, I'm a bit surprised that I (or anyone else) haven't met this
before, but then the fates are known to be a tad fickle.

getrusage04    0  TINFO  :  Expected timers granularity is 4000 us
getrusage04    0  TINFO  :  Using 1 as multiply factor for max [us]time increment (1000+4000us)!
getrusage04    0  TINFO  :  utime:           0us; stime:         179us
getrusage04    0  TINFO  :  utime:        3751us; stime:           0us
getrusage04    1  TFAIL  :  getrusage04.c:133: stime increased > 5000us:

When applying the full rtime to either stime or utime, do not overwrite
the previously tallied value.

Fixes: 9d7fb0427648 ("sched/cputime: Guarantee stime + utime == rtime")
Signed-off-by: Mike Galbraith <umgwanakikbuti@gmail.com>
Cc: stable@vger.kernel.org # 4.3+
---
 kernel/sched/cputime.c |    2 ++
 1 file changed, 2 insertions(+)

--- a/kernel/sched/cputime.c
+++ b/kernel/sched/cputime.c
@@ -608,11 +608,13 @@ static void cputime_adjust(struct task_c
 
 	if (utime == 0) {
 		stime = rtime;
+		utime = prev->utime;
 		goto update;
 	}
 
 	if (stime == 0) {
 		utime = rtime;
+		stime = prev->stime;
 		goto update;
 	}
 

             reply	other threads:[~2016-08-10 19:52 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-10 11:14 Mike Galbraith [this message]
2016-08-10 12:30 ` [patch] sched/cputime: Fix NO_HZ_FULL getrusage() monotonicity regression Peter Zijlstra
2016-08-10 12:47   ` Peter Zijlstra
2016-08-10 14:21     ` Mike Galbraith
2016-08-10 18:57   ` Mike Galbraith
2016-08-15  8:51     ` Peter Zijlstra
2016-08-15 12:29       ` Mike Galbraith

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=1470827669.15624.16.camel@gmail.com \
    --to=umgwanakikbuti@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.org \
    /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