diff options
author | Frederic Weisbecker <fweisbec@gmail.com> | 2013-07-12 13:05:14 -0400 |
---|---|---|
committer | Frederic Weisbecker <fweisbec@gmail.com> | 2013-08-12 18:40:44 -0400 |
commit | 5b206d48e58204e84d249c4eb18651a1ff7a1274 (patch) | |
tree | c97a8158df0ff854d1d6389ddde5cc1fa53bae92 | |
parent | 2d854e5738cded368a0759f85b1197f5c044513d (diff) |
vtime: Update a few comments
Update a stale comment from the old vtime era and document some
locking that might be non obvious.
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Li Zhong <zhong@linux.vnet.ibm.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Kevin Hilman <khilman@linaro.org>
-rw-r--r-- | include/linux/context_tracking.h | 10 | ||||
-rw-r--r-- | kernel/sched/cputime.c | 7 |
2 files changed, 11 insertions, 6 deletions
diff --git a/include/linux/context_tracking.h b/include/linux/context_tracking.h index 5984f2556d13..d883ff0dd8fc 100644 --- a/include/linux/context_tracking.h +++ b/include/linux/context_tracking.h | |||
@@ -72,8 +72,9 @@ extern void guest_exit(void); | |||
72 | static inline void guest_enter(void) | 72 | static inline void guest_enter(void) |
73 | { | 73 | { |
74 | /* | 74 | /* |
75 | * This is running in ioctl context so we can avoid | 75 | * This is running in ioctl context so its safe |
76 | * the call to vtime_account() with its unnecessary idle check. | 76 | * to assume that it's the stime pending cputime |
77 | * to flush. | ||
77 | */ | 78 | */ |
78 | vtime_account_system(current); | 79 | vtime_account_system(current); |
79 | current->flags |= PF_VCPU; | 80 | current->flags |= PF_VCPU; |
@@ -81,10 +82,7 @@ static inline void guest_enter(void) | |||
81 | 82 | ||
82 | static inline void guest_exit(void) | 83 | static inline void guest_exit(void) |
83 | { | 84 | { |
84 | /* | 85 | /* Flush the guest cputime we spent on the guest */ |
85 | * This is running in ioctl context so we can avoid | ||
86 | * the call to vtime_account() with its unnecessary idle check. | ||
87 | */ | ||
88 | vtime_account_system(current); | 86 | vtime_account_system(current); |
89 | current->flags &= ~PF_VCPU; | 87 | current->flags &= ~PF_VCPU; |
90 | } | 88 | } |
diff --git a/kernel/sched/cputime.c b/kernel/sched/cputime.c index a7959e05a9d5..223a35efa0a6 100644 --- a/kernel/sched/cputime.c +++ b/kernel/sched/cputime.c | |||
@@ -712,6 +712,13 @@ void vtime_user_enter(struct task_struct *tsk) | |||
712 | 712 | ||
713 | void vtime_guest_enter(struct task_struct *tsk) | 713 | void vtime_guest_enter(struct task_struct *tsk) |
714 | { | 714 | { |
715 | /* | ||
716 | * The flags must be updated under the lock with | ||
717 | * the vtime_snap flush and update. | ||
718 | * That enforces a right ordering and update sequence | ||
719 | * synchronization against the reader (task_gtime()) | ||
720 | * that can thus safely catch up with a tickless delta. | ||
721 | */ | ||
715 | write_seqlock(&tsk->vtime_seqlock); | 722 | write_seqlock(&tsk->vtime_seqlock); |
716 | __vtime_account_system(tsk); | 723 | __vtime_account_system(tsk); |
717 | current->flags |= PF_VCPU; | 724 | current->flags |= PF_VCPU; |