Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752640AbdGEKd4 (ORCPT ); Wed, 5 Jul 2017 06:33:56 -0400 Received: from terminus.zytor.com ([65.50.211.136]:52903 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752510AbdGEKdy (ORCPT ); Wed, 5 Jul 2017 06:33:54 -0400 Date: Wed, 5 Jul 2017 03:28:36 -0700 From: tip-bot for Frederic Weisbecker Message-ID: 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 Reply-To: lcapitulino@redhat.com, riel@redhat.com, hpa@zytor.com, mingo@kernel.org, tglx@linutronix.de, torvalds@linux-foundation.org, fweisbec@gmail.com, peterz@infradead.org, linux-kernel@vger.kernel.org, kernellwp@gmail.com In-Reply-To: <1498756511-11714-3-git-send-email-fweisbec@gmail.com> References: <1498756511-11714-3-git-send-email-fweisbec@gmail.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:sched/urgent] sched/cputime: Always set tsk->vtime_snap_whence after accounting vtime Git-Commit-ID: 9fa57cf5a5c4aed1e45879b335fe433048709327 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1828 Lines: 46 Commit-ID: 9fa57cf5a5c4aed1e45879b335fe433048709327 Gitweb: http://git.kernel.org/tip/9fa57cf5a5c4aed1e45879b335fe433048709327 Author: Frederic Weisbecker AuthorDate: Thu, 29 Jun 2017 19:15:08 +0200 Committer: Ingo Molnar 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 Signed-off-by: Frederic Weisbecker Reviewed-by: Thomas Gleixner Acked-by: Rik van Riel Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Wanpeng Li Link: http://lkml.kernel.org/r/1498756511-11714-3-git-send-email-fweisbec@gmail.com Signed-off-by: Ingo Molnar --- 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); }