Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755902AbbLDL4e (ORCPT ); Fri, 4 Dec 2015 06:56:34 -0500 Received: from terminus.zytor.com ([198.137.202.10]:60188 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752135AbbLDL4c (ORCPT ); Fri, 4 Dec 2015 06:56:32 -0500 Date: Fri, 4 Dec 2015 03:55:28 -0800 From: tip-bot for Frederic Weisbecker Message-ID: Cc: paulmck@linux.vnet.ibm.com, cmetcalf@ezchip.com, h-shimamoto@ct.jp.nec.com, linux-kernel@vger.kernel.org, fweisbec@gmail.com, efault@gmx.de, tglx@linutronix.de, mingo@kernel.org, riel@redhat.com, lcapitulino@redhat.com, torvalds@linux-foundation.org, cl@linux.com, peterz@infradead.org, hpa@zytor.com Reply-To: cl@linux.com, torvalds@linux-foundation.org, lcapitulino@redhat.com, riel@redhat.com, hpa@zytor.com, peterz@infradead.org, mingo@kernel.org, tglx@linutronix.de, fweisbec@gmail.com, efault@gmx.de, cmetcalf@ezchip.com, h-shimamoto@ct.jp.nec.com, paulmck@linux.vnet.ibm.com, linux-kernel@vger.kernel.org In-Reply-To: <1447948054-28668-4-git-send-email-fweisbec@gmail.com> References: <1447948054-28668-4-git-send-email-fweisbec@gmail.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:sched/core] sched/cputime: Clarify vtime symbols and document them Git-Commit-ID: 7098c1eac75dc03fdbb7249171a6e68ce6044a5a 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: 3821 Lines: 104 Commit-ID: 7098c1eac75dc03fdbb7249171a6e68ce6044a5a Gitweb: http://git.kernel.org/tip/7098c1eac75dc03fdbb7249171a6e68ce6044a5a Author: Frederic Weisbecker AuthorDate: Thu, 19 Nov 2015 16:47:30 +0100 Committer: Ingo Molnar CommitDate: Fri, 4 Dec 2015 10:34:44 +0100 sched/cputime: Clarify vtime symbols and document them VTIME_SLEEPING state happens either when: 1) The task is sleeping and no tickless delta is to be added on the task cputime stats. 2) The CPU isn't running vtime at all, so the same properties of 1) applies. Lets rename the vtime symbol to reflect both states. Signed-off-by: Frederic Weisbecker Signed-off-by: Peter Zijlstra (Intel) Cc: Chris Metcalf Cc: Christoph Lameter Cc: Hiroshi Shimamoto Cc: Linus Torvalds Cc: Luiz Capitulino Cc: Mike Galbraith Cc: Paul E . McKenney Cc: Paul E. McKenney Cc: Peter Zijlstra Cc: Rik van Riel Cc: Thomas Gleixner Link: http://lkml.kernel.org/r/1447948054-28668-4-git-send-email-fweisbec@gmail.com Signed-off-by: Ingo Molnar --- include/linux/sched.h | 5 ++++- kernel/fork.c | 2 +- kernel/sched/cputime.c | 6 +++--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/include/linux/sched.h b/include/linux/sched.h index f425aac..3533168 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -1522,8 +1522,11 @@ struct task_struct { seqlock_t vtime_seqlock; unsigned long long vtime_snap; enum { - VTIME_SLEEPING = 0, + /* Task is sleeping or running in a CPU with VTIME inactive */ + VTIME_INACTIVE = 0, + /* Task runs in userspace in a CPU with VTIME active */ VTIME_USER, + /* Task runs in kernelspace in a CPU with VTIME active */ VTIME_SYS, } vtime_snap_whence; #endif diff --git a/kernel/fork.c b/kernel/fork.c index f97f2c4..c0a1370 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -1350,7 +1350,7 @@ static struct task_struct *copy_process(unsigned long clone_flags, #ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN seqlock_init(&p->vtime_seqlock); p->vtime_snap = 0; - p->vtime_snap_whence = VTIME_SLEEPING; + p->vtime_snap_whence = VTIME_INACTIVE; #endif #if defined(SPLIT_RSS_COUNTING) diff --git a/kernel/sched/cputime.c b/kernel/sched/cputime.c index 1128d4b..4a18a6e 100644 --- a/kernel/sched/cputime.c +++ b/kernel/sched/cputime.c @@ -680,7 +680,7 @@ static cputime_t get_vtime_delta(struct task_struct *tsk) { unsigned long long delta = vtime_delta(tsk); - WARN_ON_ONCE(tsk->vtime_snap_whence == VTIME_SLEEPING); + WARN_ON_ONCE(tsk->vtime_snap_whence == VTIME_INACTIVE); tsk->vtime_snap += delta; /* CHECKME: always safe to convert nsecs to cputime? */ @@ -764,7 +764,7 @@ void vtime_account_idle(struct task_struct *tsk) void arch_vtime_task_switch(struct task_struct *prev) { write_seqlock(&prev->vtime_seqlock); - prev->vtime_snap_whence = VTIME_SLEEPING; + prev->vtime_snap_whence = VTIME_INACTIVE; write_sequnlock(&prev->vtime_seqlock); write_seqlock(¤t->vtime_seqlock); @@ -829,7 +829,7 @@ fetch_task_cputime(struct task_struct *t, *s_dst = *s_src; /* Task is sleeping, nothing to add */ - if (t->vtime_snap_whence == VTIME_SLEEPING || + if (t->vtime_snap_whence == VTIME_INACTIVE || is_idle_task(t)) continue; -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/