]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
vtime: Update a few comments
authorFrederic Weisbecker <fweisbec@gmail.com>
Fri, 12 Jul 2013 17:05:14 +0000 (19:05 +0200)
committerFrederic Weisbecker <fweisbec@gmail.com>
Mon, 12 Aug 2013 22:40:44 +0000 (00:40 +0200)
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>
include/linux/context_tracking.h
kernel/sched/cputime.c

index 5984f2556d134d512738d57f37ebdbb594f0d09f..d883ff0dd8fc72fb6ef3938bd7adcbe54956ff8b 100644 (file)
@@ -72,8 +72,9 @@ extern void guest_exit(void);
 static inline void guest_enter(void)
 {
        /*
-        * This is running in ioctl context so we can avoid
-        * the call to vtime_account() with its unnecessary idle check.
+        * This is running in ioctl context so its safe
+        * to assume that it's the stime pending cputime
+        * to flush.
         */
        vtime_account_system(current);
        current->flags |= PF_VCPU;
@@ -81,10 +82,7 @@ static inline void guest_enter(void)
 
 static inline void guest_exit(void)
 {
-       /*
-        * This is running in ioctl context so we can avoid
-        * the call to vtime_account() with its unnecessary idle check.
-        */
+       /* Flush the guest cputime we spent on the guest */
        vtime_account_system(current);
        current->flags &= ~PF_VCPU;
 }
index a7959e05a9d56ff1f53ef43cb97f2b127c018d30..223a35efa0a6bb4abbcc55ff627a5257716d1e75 100644 (file)
@@ -712,6 +712,13 @@ void vtime_user_enter(struct task_struct *tsk)
 
 void vtime_guest_enter(struct task_struct *tsk)
 {
+       /*
+        * The flags must be updated under the lock with
+        * the vtime_snap flush and update.
+        * That enforces a right ordering and update sequence
+        * synchronization against the reader (task_gtime())
+        * that can thus safely catch up with a tickless delta.
+        */
        write_seqlock(&tsk->vtime_seqlock);
        __vtime_account_system(tsk);
        current->flags |= PF_VCPU;