public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Frederic Weisbecker <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: lcapitulino@redhat.com, riel@redhat.com, hpa@zytor.com,
	mingo@kernel.org, tglx@linutronix.de, fweisbec@gmail.com,
	torvalds@linux-foundation.org, peterz@infradead.org,
	linux-kernel@vger.kernel.org, kernellwp@gmail.com
Subject: [tip:sched/urgent] sched/cputime: Always set tsk->vtime_snap_whence after accounting vtime
Date: Wed, 5 Jul 2017 03:28:36 -0700	[thread overview]
Message-ID: <tip-9fa57cf5a5c4aed1e45879b335fe433048709327@git.kernel.org> (raw)
In-Reply-To: <1498756511-11714-3-git-send-email-fweisbec@gmail.com>

Commit-ID:  9fa57cf5a5c4aed1e45879b335fe433048709327
Gitweb:     http://git.kernel.org/tip/9fa57cf5a5c4aed1e45879b335fe433048709327
Author:     Frederic Weisbecker <fweisbec@gmail.com>
AuthorDate: Thu, 29 Jun 2017 19:15:08 +0200
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Wed, 5 Jul 2017 09:54:14 +0200

sched/cputime: Always set tsk->vtime_snap_whence after accounting vtime

Even though it doesn't have functional consequences, setting
the task's new context state after we actually accounted the pending
vtime from the old context state makes more sense from a review
perspective.

vtime_user_exit() is the only function that doesn't follow that rule
and that can bug the reviewer for a little while until he realizes there
is no reason for this special case.

Tested-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Rik van Riel <riel@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Wanpeng Li <kernellwp@gmail.com>
Link: http://lkml.kernel.org/r/1498756511-11714-3-git-send-email-fweisbec@gmail.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 kernel/sched/cputime.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/sched/cputime.c b/kernel/sched/cputime.c
index 5adc896..ab68927 100644
--- a/kernel/sched/cputime.c
+++ b/kernel/sched/cputime.c
@@ -736,9 +736,9 @@ void vtime_user_enter(struct task_struct *tsk)
 void vtime_user_exit(struct task_struct *tsk)
 {
 	write_seqcount_begin(&tsk->vtime_seqcount);
-	tsk->vtime_snap_whence = VTIME_SYS;
 	if (vtime_delta(tsk))
 		account_user_time(tsk, get_vtime_delta(tsk));
+	tsk->vtime_snap_whence = VTIME_SYS;
 	write_seqcount_end(&tsk->vtime_seqcount);
 }
 

  parent reply	other threads:[~2017-07-05 10:33 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-29 17:15 [RFC PATCH 0/5] vtime: Fix wrong user and system time accounting Frederic Weisbecker
2017-06-29 17:15 ` [PATCH 1/5] vtime: Remove vtime_account_user() Frederic Weisbecker
2017-06-29 23:01   ` Rik van Riel
2017-07-05 10:28   ` [tip:sched/urgent] vtime, sched/cputime: " tip-bot for Frederic Weisbecker
2017-06-29 17:15 ` [PATCH 2/5] sched: Always set vtime_snap_whence after accounting vtime Frederic Weisbecker
2017-06-29 23:01   ` Rik van Riel
2017-07-05 10:28   ` tip-bot for Frederic Weisbecker [this message]
2017-06-29 17:15 ` [PATCH 3/5] sched: Rename vtime fields Frederic Weisbecker
2017-06-29 23:02   ` Rik van Riel
2017-07-05 10:28   ` [tip:sched/urgent] sched/cputime: " tip-bot for Frederic Weisbecker
2017-06-29 17:15 ` [PATCH 4/5] sched: Move vtime task fields to their own struct Frederic Weisbecker
2017-06-29 23:05   ` Rik van Riel
2017-07-05 10:29   ` [tip:sched/urgent] sched/cputime: Move the " tip-bot for Frederic Weisbecker
2017-06-29 17:15 ` [PATCH 5/5] sched: Accumulate vtime on top of nsec clocksource Frederic Weisbecker
2017-06-29 23:27   ` Rik van Riel
2017-07-05 13:20     ` Frederic Weisbecker
2017-06-30  1:52   ` Wanpeng Li
2017-07-05 10:29   ` [tip:sched/urgent] sched/cputime: " tip-bot for Wanpeng Li
2017-07-15  3:37   ` [PATCH 5/5] sched: " Levin, Alexander (Sasha Levin)
2017-07-15  5:26     ` Wanpeng Li
2017-06-30  1:41 ` [RFC PATCH 0/5] vtime: Fix wrong user and system time accounting Wanpeng Li
2017-06-30 17:32   ` Luiz Capitulino
2017-07-03 10:28 ` Thomas Gleixner
2017-07-04 16:52 ` Luiz Capitulino
2017-07-05 13:16   ` Frederic Weisbecker

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=tip-9fa57cf5a5c4aed1e45879b335fe433048709327@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=fweisbec@gmail.com \
    --cc=hpa@zytor.com \
    --cc=kernellwp@gmail.com \
    --cc=lcapitulino@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=riel@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.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