On Tue, 2013-01-08 at 03:08 +0100, Frederic Weisbecker wrote:

> +++ b/kernel/sched/cputime.c
> @@ -3,6 +3,7 @@
>  #include <linux/tsacct_kern.h>
>  #include <linux/kernel_stat.h>
>  #include <linux/static_key.h>
> +#include <linux/context_tracking.h>
>  #include "sched.h"
>  
> 
> @@ -495,10 +496,24 @@ void vtime_task_switch(struct task_struct *prev)
>  #ifndef __ARCH_HAS_VTIME_ACCOUNT
>  void vtime_account(struct task_struct *tsk)
>  {
> -     if (in_interrupt() || !is_idle_task(tsk))
> -             vtime_account_system(tsk);
> -     else
> -             vtime_account_idle(tsk);
> +     if (!in_interrupt()) {
> +             /*
> +              * If we interrupted user, context_tracking_in_user()
> +              * is 1 because the context tracking don't hook

s/don't/doesn't/

> +              * on irq entry/exit. This way we know if
> +              * we need to flush user time on kernel entry.

Also, the above comment is simply confusing. Why not just say something
like:

 Context tracking doesn't hook on irq entry/exit. The context will still
 be user context if the interrupt preempted user space.

No need to explain the implementation details of
"context_tracing_in_user() is 1 ...".

-- Steve

> +              */
> +             if (context_tracking_in_user()) {
> +                     vtime_account_user(tsk);
> +                     return;
> +             }
> +
> +             if (is_idle_task(tsk)) {
> +                     vtime_account_idle(tsk);
> +                     return;
> +             }
> +     }
> +     vtime_account_system(tsk);
>  }
>  EXPORT_SYMBOL_GPL(vtime_account);
>  #endif /* __ARCH_HAS_VTIME_ACCOUNT */
> @@ -587,3 +602,72 @@ void thread_group_cputime_adjusted(struct task_struct 
> *p, cputime_t *ut, cputime
>       cputime_adjust(&cputime, &p->signal->prev_cputime, ut, st);
>  }
>  #endif


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to