Merge tag 'full-dynticks-cputime-for-mingo' of git://git.kernel.org/pub/scm/linux...
authorIngo Molnar <mingo@kernel.org>
Tue, 5 Feb 2013 12:10:33 +0000 (13:10 +0100)
committerIngo Molnar <mingo@kernel.org>
Tue, 5 Feb 2013 12:10:33 +0000 (13:10 +0100)
Pull full-dynticks (user-space execution is undisturbed and
receives no timer IRQs) preparation changes that convert the
cputime accounting code to be full-dynticks ready,
from Frederic Weisbecker:

 "This implements the cputime accounting on full dynticks CPUs.

  Typical cputime stats infrastructure relies on the timer tick and
  its periodic polling on the CPU to account the amount of time
  spent by the CPUs and the tasks per high level domains such as
  userspace, kernelspace, guest, ...

  Now we are preparing to implement full dynticks capability on
  Linux for Real Time and HPC users who want full CPU isolation.
  This feature requires a cputime accounting that doesn't depend
  on the timer tick.

  To implement it, this new cputime infrastructure plugs into
  kernel/user/guest boundaries to take snapshots of cputime and
  flush these to the stats when needed. This performs pretty
  much like CONFIG_VIRT_CPU_ACCOUNTING except that context location
  and cputime snaphots are synchronized between write and read
  side such that the latter can safely retrieve the pending tickless
  cputime of a task and add it to its latest cputime snapshot to
  return the correct result to the user."

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
1  2 
include/linux/sched.h
kernel/fork.c
kernel/sched/core.c
kernel/sched/cputime.c
kernel/signal.c

Simple merge
diff --cc kernel/fork.c
Simple merge
Simple merge
index 825a956ccdb6eea475cf141838dd0b5d396d0d23,082e05d915b47600663b51fdf3b33df98b415ec3..ccff2752725ad51bfe6bcfd3425eb0e0a516a7bb
@@@ -493,23 -492,36 +492,36 @@@ void vtime_task_switch(struct task_stru
   * vtime_account().
   */
  #ifndef __ARCH_HAS_VTIME_ACCOUNT
- void vtime_account(struct task_struct *tsk)
+ void vtime_account_irq_enter(struct task_struct *tsk)
  {
-       if (in_interrupt() || !is_idle_task(tsk))
-               vtime_account_system(tsk);
-       else
-               vtime_account_idle(tsk);
+       if (!vtime_accounting_enabled())
+               return;
+       if (!in_interrupt()) {
+               /*
+                * If we interrupted user, context_tracking_in_user()
+                * is 1 because the context tracking don't hook
+                * on irq entry/exit. This way we know if
+                * we need to flush user time on kernel entry.
+                */
+               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);
+ EXPORT_SYMBOL_GPL(vtime_account_irq_enter);
  #endif /* __ARCH_HAS_VTIME_ACCOUNT */
  
- #else
- #ifndef nsecs_to_cputime
- # define nsecs_to_cputime(__nsecs)    nsecs_to_jiffies(__nsecs)
- #endif
+ #else /* !CONFIG_VIRT_CPU_ACCOUNTING */
  
 -static cputime_t scale_utime(cputime_t utime, cputime_t rtime, cputime_t total)
 +static cputime_t scale_stime(cputime_t stime, cputime_t rtime, cputime_t total)
  {
        u64 temp = (__force u64) rtime;
  
diff --cc kernel/signal.c
Simple merge