aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorFrederic Weisbecker <fweisbec@gmail.com>2015-11-19 10:47:30 -0500
committerIngo Molnar <mingo@kernel.org>2015-12-04 04:34:44 -0500
commit7098c1eac75dc03fdbb7249171a6e68ce6044a5a (patch)
tree06b4c828297c06b6aaa5494054a5cb9855e2d198 /kernel
parent7877a0ba5ec63c7b0111b06c773f1696fa17b35a (diff)
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 <fweisbec@gmail.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: Chris Metcalf <cmetcalf@ezchip.com> Cc: Christoph Lameter <cl@linux.com> Cc: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Luiz Capitulino <lcapitulino@redhat.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Paul E . McKenney <paulmck@linux.vnet.ibm.com> Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Rik van Riel <riel@redhat.com> Cc: Thomas Gleixner <tglx@linutronix.de> Link: http://lkml.kernel.org/r/1447948054-28668-4-git-send-email-fweisbec@gmail.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/fork.c2
-rw-r--r--kernel/sched/cputime.c6
2 files changed, 4 insertions, 4 deletions
diff --git a/kernel/fork.c b/kernel/fork.c
index f97f2c449f5c..c0a13706b1a7 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -1350,7 +1350,7 @@ static struct task_struct *copy_process(unsigned long clone_flags,
1350#ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN 1350#ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN
1351 seqlock_init(&p->vtime_seqlock); 1351 seqlock_init(&p->vtime_seqlock);
1352 p->vtime_snap = 0; 1352 p->vtime_snap = 0;
1353 p->vtime_snap_whence = VTIME_SLEEPING; 1353 p->vtime_snap_whence = VTIME_INACTIVE;
1354#endif 1354#endif
1355 1355
1356#if defined(SPLIT_RSS_COUNTING) 1356#if defined(SPLIT_RSS_COUNTING)
diff --git a/kernel/sched/cputime.c b/kernel/sched/cputime.c
index 1128d4ba6c55..4a18a6ed7723 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)
680{ 680{
681 unsigned long long delta = vtime_delta(tsk); 681 unsigned long long delta = vtime_delta(tsk);
682 682
683 WARN_ON_ONCE(tsk->vtime_snap_whence == VTIME_SLEEPING); 683 WARN_ON_ONCE(tsk->vtime_snap_whence == VTIME_INACTIVE);
684 tsk->vtime_snap += delta; 684 tsk->vtime_snap += delta;
685 685
686 /* CHECKME: always safe to convert nsecs to cputime? */ 686 /* CHECKME: always safe to convert nsecs to cputime? */
@@ -764,7 +764,7 @@ void vtime_account_idle(struct task_struct *tsk)
764void arch_vtime_task_switch(struct task_struct *prev) 764void arch_vtime_task_switch(struct task_struct *prev)
765{ 765{
766 write_seqlock(&prev->vtime_seqlock); 766 write_seqlock(&prev->vtime_seqlock);
767 prev->vtime_snap_whence = VTIME_SLEEPING; 767 prev->vtime_snap_whence = VTIME_INACTIVE;
768 write_sequnlock(&prev->vtime_seqlock); 768 write_sequnlock(&prev->vtime_seqlock);
769 769
770 write_seqlock(&current->vtime_seqlock); 770 write_seqlock(&current->vtime_seqlock);
@@ -829,7 +829,7 @@ fetch_task_cputime(struct task_struct *t,
829 *s_dst = *s_src; 829 *s_dst = *s_src;
830 830
831 /* Task is sleeping, nothing to add */ 831 /* Task is sleeping, nothing to add */
832 if (t->vtime_snap_whence == VTIME_SLEEPING || 832 if (t->vtime_snap_whence == VTIME_INACTIVE ||
833 is_idle_task(t)) 833 is_idle_task(t))
834 continue; 834 continue;
835 835