All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Low <jason.low2@hp.com>
To: "Fredrik Markström" <fredrik.markstrom@gmail.com>
Cc: "Peter Zijlstra" <peterz@infradead.org>,
	mingo@redhat.com, linux-kernel@vger.kernel.org,
	"Rik van Riel" <riel@redhat.com>,
	"Frédéric Weisbecker" <fweisbec@gmail.com>,
	jason.low2@hp.com
Subject: Re: [PATCH 1/1] cputime: Make the reported utime+stime correspond to the actual runtime.
Date: Mon, 29 Jun 2015 11:54:50 -0700	[thread overview]
Message-ID: <1435604090.21928.19.camel@j-VirtualBox> (raw)
In-Reply-To: <CAKdL+dRPEenCzi14SWypOv6Vv+x2X0bHQXXc-G6gqUT+VhOtUw@mail.gmail.com>

On Mon, 2015-06-29 at 17:28 +0200, Fredrik Markström wrote:
> Hello Peter, the locking part looks good, I don't have a strong
> opinion on per task/signal lock vs global lock.
> 
> But with the patch we still update prev->utime and prev->stime
> independently, which was the original problem.  But maybe the locking
> and monoticity/sum issue should be addressed by two separate patches
> since they are separate bugs ?
> 
> The part I'm referring to is the change below from my original patch
> (maybe without the WARN_ON:s ?):
> 
> …
> -       cputime_advance(&prev->stime, stime);
> -       cputime_advance(&prev->utime, utime);
> +       if (stime < prev->stime) {
> +               stime = prev->stime;
> +               utime = rtime - stime;
> +       } else if (utime < prev->utime) {
> +               utime = prev->utime;
> +               stime = rtime - utime;
> +       }
> +       WARN_ON(stime < prev->stime);
> +       WARN_ON(utime < prev->utime);
> +       WARN_ON(stime + utime != rtime);

How about substituting:

	prev->stime = max(prev->stime, stime);
	prev->utime = max(prev->utime, utime);

with

        if (stime > prev->stime || utime > prev->utime) {
		prev->stime = stime;
		prev->utime = utime;
	}

in Peter's patch?


  reply	other threads:[~2015-06-29 18:54 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
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 [this message]
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=1435604090.21928.19.camel@j-VirtualBox \
    --to=jason.low2@hp.com \
    --cc=fredrik.markstrom@gmail.com \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.