Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1677969

[PATCH 2/5] sched: Always set vtime_snap_whence after accounting vtime

From Frederic Weisbecker <fweisbec@gmail.com>
Newsgroups linux.kernel
Subject [PATCH 2/5] sched: Always set vtime_snap_whence after accounting vtime
Date 2017-06-29 19:20 +0200
Message-ID <tXLgJ-1X8-9@gated-at.bofh.it> (permalink)
References <tXLgJ-1X8-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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.

Cc: Wanpeng Li <kernellwp@gmail.com>
Cc: Rik van Riel <riel@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
---
 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 5e080ca..db7ef10 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);
 }
 
-- 
2.7.4

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[RFC PATCH 0/5] vtime: Fix wrong user and system time accounting Frederic Weisbecker <fweisbec@gmail.com> - 2017-06-29 19:20 +0200
  [PATCH 2/5] sched: Always set vtime_snap_whence after accounting vtime Frederic Weisbecker <fweisbec@gmail.com> - 2017-06-29 19:20 +0200
    Re: [PATCH 2/5] sched: Always set vtime_snap_whence after  accounting vtime Rik van Riel <riel@redhat.com> - 2017-06-30 01:10 +0200
  [PATCH 5/5] sched: Accumulate vtime on top of nsec clocksource Frederic Weisbecker <fweisbec@gmail.com> - 2017-06-29 19:20 +0200
    Re: [PATCH 5/5] sched: Accumulate vtime on top of nsec clocksource Rik van Riel <riel@redhat.com> - 2017-06-30 01:30 +0200
    Re: [PATCH 5/5] sched: Accumulate vtime on top of nsec clocksource Wanpeng Li <kernellwp@gmail.com> - 2017-06-30 04:00 +0200
  [PATCH 4/5] sched: Move vtime task fields to their own struct Frederic Weisbecker <fweisbec@gmail.com> - 2017-06-29 19:20 +0200
    Re: [PATCH 4/5] sched: Move vtime task fields to their own struct Rik van Riel <riel@redhat.com> - 2017-06-30 01:10 +0200
  [PATCH 1/5] vtime: Remove vtime_account_user() Frederic Weisbecker <fweisbec@gmail.com> - 2017-06-29 19:20 +0200
    Re: [PATCH 1/5] vtime: Remove vtime_account_user() Rik van Riel <riel@redhat.com> - 2017-06-30 01:10 +0200
  [PATCH 3/5] sched: Rename vtime fields Frederic Weisbecker <fweisbec@gmail.com> - 2017-06-29 19:20 +0200
    Re: [PATCH 3/5] sched: Rename vtime fields Rik van Riel <riel@redhat.com> - 2017-06-30 01:10 +0200
  Re: [RFC PATCH 0/5] vtime: Fix wrong user and system time accounting Wanpeng Li <kernellwp@gmail.com> - 2017-06-30 03:50 +0200
    Re: [RFC PATCH 0/5] vtime: Fix wrong user and system time  accounting Luiz Capitulino <lcapitulino@redhat.com> - 2017-06-30 19:40 +0200
  Re: [RFC PATCH 0/5] vtime: Fix wrong user and system time  accounting Thomas Gleixner <tglx@linutronix.de> - 2017-07-03 12:30 +0200

csiph-web