Merge branch 'tracing-v28-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
authorLinus Torvalds <torvalds@linux-foundation.org>
Mon, 20 Oct 2008 20:35:07 +0000 (13:35 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 20 Oct 2008 20:35:07 +0000 (13:35 -0700)
* 'tracing-v28-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: (131 commits)
  tracing/fastboot: improve help text
  tracing/stacktrace: improve help text
  tracing/fastboot: fix initcalls disposition in bootgraph.pl
  tracing/fastboot: fix bootgraph.pl initcall name regexp
  tracing/fastboot: fix issues and improve output of bootgraph.pl
  tracepoints: synchronize unregister static inline
  tracepoints: tracepoint_synchronize_unregister()
  ftrace: make ftrace_test_p6nop disassembler-friendly
  markers: fix synchronize marker unregister static inline
  tracing/fastboot: add better resolution to initcall debug/tracing
  trace: add build-time check to avoid overrunning hex buffer
  ftrace: fix hex output mode of ftrace
  tracing/fastboot: fix initcalls disposition in bootgraph.pl
  tracing/fastboot: fix printk format typo in boot tracer
  ftrace: return an error when setting a nonexistent tracer
  ftrace: make some tracers reentrant
  ring-buffer: make reentrant
  ring-buffer: move page indexes into page headers
  tracing/fastboot: only trace non-module initcalls
  ftrace: move pc counter in irqtrace
  ...

Manually fix conflicts:
 - init/main.c: initcall tracing
 - kernel/module.c: verbose level vs tracepoints
 - scripts/bootgraph.pl: fallout from cherry-picking commits.

15 files changed:
1  2 
arch/x86/Kconfig
arch/x86/kernel/entry_32.S
include/asm-generic/vmlinux.lds.h
include/linux/init.h
include/linux/kernel.h
include/linux/module.h
init/Kconfig
init/main.c
kernel/Makefile
kernel/exit.c
kernel/fork.c
kernel/kthread.c
kernel/module.c
kernel/sched.c
kernel/signal.c

diff --combined arch/x86/Kconfig
@@@ -18,7 -18,6 +18,7 @@@ config X86_6
  ### Arch settings
  config X86
        def_bool y
 +      select HAVE_AOUT if X86_32
        select HAVE_UNSTABLE_SCHED_CLOCK
        select HAVE_IDE
        select HAVE_OPROFILE
@@@ -26,6 -25,7 +26,7 @@@
        select HAVE_KPROBES
        select ARCH_WANT_OPTIONAL_GPIOLIB
        select HAVE_KRETPROBES
+       select HAVE_FTRACE_MCOUNT_RECORD
        select HAVE_DYNAMIC_FTRACE
        select HAVE_FTRACE
        select HAVE_KVM if ((X86_32 && !X86_VOYAGER && !X86_VISWS && !X86_NUMAQ) || X86_64)
@@@ -39,6 -39,10 +40,6 @@@ config ARCH_DEFCONFI
        default "arch/x86/configs/i386_defconfig" if X86_32
        default "arch/x86/configs/x86_64_defconfig" if X86_64
  
 -
 -config GENERIC_LOCKBREAK
 -      def_bool n
 -
  config GENERIC_TIME
        def_bool y
  
@@@ -91,7 -95,7 +92,7 @@@ config GENERIC_HWEIGH
        def_bool y
  
  config GENERIC_GPIO
 -      def_bool n
 +      bool
  
  config ARCH_MAY_HAVE_PC_FDC
        def_bool y
@@@ -102,6 -106,12 +103,6 @@@ config RWSEM_GENERIC_SPINLOC
  config RWSEM_XCHGADD_ALGORITHM
        def_bool X86_XADD
  
 -config ARCH_HAS_ILOG2_U32
 -      def_bool n
 -
 -config ARCH_HAS_ILOG2_U64
 -      def_bool n
 -
  config ARCH_HAS_CPU_IDLE_WAIT
        def_bool y
  
@@@ -143,6 -153,9 +144,6 @@@ config AUDIT_ARC
        bool
        default X86_64
  
 -config ARCH_SUPPORTS_AOUT
 -      def_bool y
 -
  config ARCH_SUPPORTS_OPTIMIZED_INLINING
        def_bool y
  
@@@ -193,7 -206,6 +194,7 @@@ config X86_TRAMPOLIN
  config KTIME_SCALAR
        def_bool X86_32
  source "init/Kconfig"
 +source "kernel/Kconfig.freezer"
  
  menu "Processor type and features"
  
@@@ -749,8 -761,9 +750,8 @@@ config I8
          Say N otherwise.
  
  config X86_REBOOTFIXUPS
 -      def_bool n
 -      prompt "Enable X86 board specific fixups for reboot"
 -      depends on X86_32 && X86
 +      bool "Enable X86 board specific fixups for reboot"
 +      depends on X86_32
        ---help---
          This enables chipset and/or board specific fixups to be done
          in order to get reboot to work correctly. This is only needed on
@@@ -934,17 -947,16 +935,17 @@@ config HIGHME
        depends on X86_32 && (HIGHMEM64G || HIGHMEM4G)
  
  config X86_PAE
 -      def_bool n
 -      prompt "PAE (Physical Address Extension) Support"
 +      bool "PAE (Physical Address Extension) Support"
        depends on X86_32 && !HIGHMEM4G
 -      select RESOURCES_64BIT
        help
          PAE is required for NX support, and furthermore enables
          larger swapspace support for non-overcommit purposes. It
          has the cost of more pagetable lookup overhead, and also
          consumes more pagetable space per process.
  
 +config ARCH_PHYS_ADDR_T_64BIT
 +       def_bool X86_64 || X86_PAE
 +
  # Common NUMA Features
  config NUMA
        bool "Numa Memory Allocation and Scheduler Support (EXPERIMENTAL)"
@@@ -1229,7 -1241,8 +1230,7 @@@ config X86_PA
          If unsure, say Y.
  
  config EFI
 -      def_bool n
 -      prompt "EFI runtime service support"
 +      bool "EFI runtime service support"
        depends on ACPI
        ---help---
        This enables the kernel to use EFI runtime services that are
        resultant kernel should continue to boot on existing non-EFI
        platforms.
  
 -config IRQBALANCE
 -      def_bool y
 -      prompt "Enable kernel irq balancing"
 -      depends on X86_32 && SMP && X86_IO_APIC
 -      help
 -        The default yes will allow the kernel to do irq load balancing.
 -        Saying no will keep the kernel from doing irq load balancing.
 -
  config SECCOMP
        def_bool y
        prompt "Enable seccomp to safely compute untrusted bytecode"
@@@ -1865,7 -1886,7 +1866,7 @@@ config IA32_EMULATIO
  
  config IA32_AOUT
         tristate "IA32 a.out support"
 -       depends on IA32_EMULATION && ARCH_SUPPORTS_AOUT
 +       depends on IA32_EMULATION
         help
           Support old a.out binaries in the 32bit emulation.
  
@@@ -629,7 -629,7 +629,7 @@@ ENTRY(interrupt
  ENTRY(irq_entries_start)
        RING0_INT_FRAME
  vector=0
 -.rept NR_IRQS
 +.rept NR_VECTORS
        ALIGN
   .if vector
        CFI_ADJUST_CFA_OFFSET -4
@@@ -1153,20 -1153,6 +1153,6 @@@ ENDPROC(xen_failsafe_callback
  #ifdef CONFIG_DYNAMIC_FTRACE
  
  ENTRY(mcount)
-       pushl %eax
-       pushl %ecx
-       pushl %edx
-       movl 0xc(%esp), %eax
-       subl $MCOUNT_INSN_SIZE, %eax
- .globl mcount_call
- mcount_call:
-       call ftrace_stub
-       popl %edx
-       popl %ecx
-       popl %eax
        ret
  END(mcount)
  
  #define MEM_DISCARD(sec) *(.mem##sec)
  #endif
  
+ #ifdef CONFIG_FTRACE_MCOUNT_RECORD
+ #define MCOUNT_REC()  VMLINUX_SYMBOL(__start_mcount_loc) = .; \
+                       *(__mcount_loc)                         \
+                       VMLINUX_SYMBOL(__stop_mcount_loc) = .;
+ #else
+ #define MCOUNT_REC()
+ #endif
  
  /* .data section */
  #define DATA_DATA                                                     \
        . = ALIGN(8);                                                   \
        VMLINUX_SYMBOL(__start___markers) = .;                          \
        *(__markers)                                                    \
-       VMLINUX_SYMBOL(__stop___markers) = .;
+       VMLINUX_SYMBOL(__stop___markers) = .;                           \
+       VMLINUX_SYMBOL(__start___tracepoints) = .;                      \
+       *(__tracepoints)                                                \
+       VMLINUX_SYMBOL(__stop___tracepoints) = .;
  
  #define RO_DATA(align)                                                        \
        . = ALIGN((align));                                             \
@@@ -61,6 -71,7 +71,7 @@@
                *(.rodata) *(.rodata.*)                                 \
                *(__vermagic)           /* Kernel version magic */      \
                *(__markers_strings)    /* Markers: strings */          \
+               *(__tracepoints_strings)/* Tracepoints: strings */      \
        }                                                               \
                                                                        \
        .rodata1          : AT(ADDR(.rodata1) - LOAD_OFFSET) {          \
        /* __*init sections */                                          \
        __init_rodata : AT(ADDR(__init_rodata) - LOAD_OFFSET) {         \
                *(.ref.rodata)                                          \
+               MCOUNT_REC()                                            \
                DEV_KEEP(init.rodata)                                   \
                DEV_KEEP(exit.rodata)                                   \
                CPU_KEEP(init.rodata)                                   \
        CPU_DISCARD(init.data)                                          \
        CPU_DISCARD(init.rodata)                                        \
        MEM_DISCARD(init.data)                                          \
 -      MEM_DISCARD(init.rodata)
 +      MEM_DISCARD(init.rodata)                                        \
 +      /* implement dynamic printk debug */                            \
 +      VMLINUX_SYMBOL(__start___verbose_strings) = .;                  \
 +      *(__verbose_strings)                                            \
 +      VMLINUX_SYMBOL(__stop___verbose_strings) = .;                   \
 +      . = ALIGN(8);                                                   \
 +      VMLINUX_SYMBOL(__start___verbose) = .;                          \
 +      *(__verbose)                                                    \
 +      VMLINUX_SYMBOL(__stop___verbose) = .;
  
  #define INIT_TEXT                                                     \
        *(.init.text)                                                   \
diff --combined include/linux/init.h
@@@ -40,7 -40,7 +40,7 @@@
  
  /* These are for everybody (although not all archs will actually
     discard it in modules) */
- #define __init                __section(.init.text) __cold
+ #define __init                __section(.init.text) __cold notrace
  #define __initdata    __section(.init.data)
  #define __initconst   __section(.init.rodata)
  #define __exitdata    __section(.exit.data)
@@@ -233,6 -233,9 +233,6 @@@ struct obs_kernel_param 
                __attribute__((aligned((sizeof(long)))))        \
                = { __setup_str_##unique_id, fn, early }
  
 -#define __setup_null_param(str, unique_id)                    \
 -      __setup_param(str, unique_id, NULL, 0)
 -
  #define __setup(str, fn)                                      \
        __setup_param(str, fn, fn, 0)
  
@@@ -293,6 -296,7 +293,6 @@@ void __init parse_early_param(void)
        void cleanup_module(void) __attribute__((alias(#exitfn)));
  
  #define __setup_param(str, unique_id, fn)     /* nothing */
 -#define __setup_null_param(str, unique_id)    /* nothing */
  #define __setup(str, func)                    /* nothing */
  #endif
  
diff --combined include/linux/kernel.h
@@@ -16,7 -16,6 +16,7 @@@
  #include <linux/log2.h>
  #include <linux/typecheck.h>
  #include <linux/ratelimit.h>
 +#include <linux/dynamic_printk.h>
  #include <asm/byteorder.h>
  #include <asm/bug.h>
  
@@@ -214,9 -213,6 +214,9 @@@ static inline bool printk_timed_ratelim
                { return false; }
  #endif
  
 +extern int printk_needs_cpu(int cpu);
 +extern void printk_tick(void);
 +
  extern void asmlinkage __attribute__((format(printf, 1, 2)))
        early_printk(const char *fmt, ...);
  
@@@ -239,10 -235,9 +239,10 @@@ extern int oops_in_progress;             /* If set
  extern int panic_timeout;
  extern int panic_on_oops;
  extern int panic_on_unrecovered_nmi;
 -extern int tainted;
  extern const char *print_tainted(void);
 -extern void add_taint(unsigned);
 +extern void add_taint(unsigned flag);
 +extern int test_taint(unsigned flag);
 +extern unsigned long get_taint(void);
  extern int root_mountflags;
  
  /* Values used for system_state */
@@@ -255,17 -250,16 +255,17 @@@ extern enum system_states 
        SYSTEM_SUSPEND_DISK,
  } system_state;
  
 -#define TAINT_PROPRIETARY_MODULE      (1<<0)
 -#define TAINT_FORCED_MODULE           (1<<1)
 -#define TAINT_UNSAFE_SMP              (1<<2)
 -#define TAINT_FORCED_RMMOD            (1<<3)
 -#define TAINT_MACHINE_CHECK           (1<<4)
 -#define TAINT_BAD_PAGE                        (1<<5)
 -#define TAINT_USER                    (1<<6)
 -#define TAINT_DIE                     (1<<7)
 -#define TAINT_OVERRIDDEN_ACPI_TABLE   (1<<8)
 -#define TAINT_WARN                    (1<<9)
 +#define TAINT_PROPRIETARY_MODULE      0
 +#define TAINT_FORCED_MODULE           1
 +#define TAINT_UNSAFE_SMP              2
 +#define TAINT_FORCED_RMMOD            3
 +#define TAINT_MACHINE_CHECK           4
 +#define TAINT_BAD_PAGE                        5
 +#define TAINT_USER                    6
 +#define TAINT_DIE                     7
 +#define TAINT_OVERRIDDEN_ACPI_TABLE   8
 +#define TAINT_WARN                    9
 +#define TAINT_CRAP                    10
  
  extern void dump_stack(void) __cold;
  
@@@ -309,12 -303,8 +309,12 @@@ static inline char *pack_hex_byte(char 
  #define pr_info(fmt, arg...) \
        printk(KERN_INFO fmt, ##arg)
  
 -#ifdef DEBUG
  /* If you are writing a driver, please use dev_dbg instead */
 +#if defined(CONFIG_DYNAMIC_PRINTK_DEBUG)
 +#define pr_debug(fmt, ...) do { \
 +      dynamic_pr_debug(fmt, ##__VA_ARGS__); \
 +      } while (0)
 +#elif defined(DEBUG)
  #define pr_debug(fmt, arg...) \
        printk(KERN_DEBUG fmt, ##arg)
  #else
@@@ -496,4 -486,9 +496,9 @@@ struct sysinfo 
  #define NUMA_BUILD 0
  #endif
  
+ /* Rebuild everything on CONFIG_FTRACE_MCOUNT_RECORD */
+ #ifdef CONFIG_FTRACE_MCOUNT_RECORD
+ # define REBUILD_DUE_TO_FTRACE_MCOUNT_RECORD
+ #endif
  #endif
diff --combined include/linux/module.h
@@@ -16,6 -16,7 +16,7 @@@
  #include <linux/kobject.h>
  #include <linux/moduleparam.h>
  #include <linux/marker.h>
+ #include <linux/tracepoint.h>
  #include <asm/local.h>
  
  #include <asm/module.h>
@@@ -331,6 -332,10 +332,10 @@@ struct modul
        struct marker *markers;
        unsigned int num_markers;
  #endif
+ #ifdef CONFIG_TRACEPOINTS
+       struct tracepoint *tracepoints;
+       unsigned int num_tracepoints;
+ #endif
  
  #ifdef CONFIG_MODULE_UNLOAD
        /* What modules depend on me? */
        /* Reference counts */
        struct module_ref ref[NR_CPUS];
  #endif
 -
  };
  #ifndef MODULE_ARCH_INIT
  #define MODULE_ARCH_INIT {}
@@@ -453,6 -459,9 +458,9 @@@ extern void print_modules(void)
  
  extern void module_update_markers(void);
  
+ extern void module_update_tracepoints(void);
+ extern int module_get_iter_tracepoints(struct tracepoint_iter *iter);
  #else /* !CONFIG_MODULES... */
  #define EXPORT_SYMBOL(sym)
  #define EXPORT_SYMBOL_GPL(sym)
@@@ -557,6 -566,15 +565,15 @@@ static inline void module_update_marker
  {
  }
  
+ static inline void module_update_tracepoints(void)
+ {
+ }
+ static inline int module_get_iter_tracepoints(struct tracepoint_iter *iter)
+ {
+       return 0;
+ }
  #endif /* CONFIG_MODULES */
  
  struct device_driver;
diff --combined init/Kconfig
@@@ -299,13 -299,6 +299,13 @@@ config CGROUP_N
            for instance virtual servers and checkpoint/restart
            jobs.
  
 +config CGROUP_FREEZER
 +        bool "control group freezer subsystem"
 +        depends on CGROUPS
 +        help
 +          Provides a way to freeze and unfreeze all tasks in a
 +        cgroup.
 +
  config CGROUP_DEVICE
        bool "Device controller for cgroups"
        depends on CGROUPS && EXPERIMENTAL
@@@ -720,14 -713,6 +720,14 @@@ config SHME
          option replaces shmem and tmpfs with the much simpler ramfs code,
          which may be appropriate on small systems without swap.
  
 +config AIO
 +      bool "Enable AIO support" if EMBEDDED
 +      default y
 +      help
 +        This option enables POSIX asynchronous I/O which may by used
 +          by some high performance threaded applications. Disabling
 +          this option saves about 7k.
 +
  config VM_EVENT_COUNTERS
        default y
        bool "Enable VM event counters for /proc/vmstat" if EMBEDDED
@@@ -786,6 -771,13 +786,13 @@@ config PROFILIN
          Say Y here to enable the extended profiling support mechanisms used
          by profilers such as OProfile.
  
+ #
+ # Place an empty function call at each tracepoint site. Can be
+ # dynamically changed for a probe function.
+ #
+ config TRACEPOINTS
+       bool
  config MARKERS
        bool "Activate markers"
        help
  
  source "arch/Kconfig"
  
 -config PROC_PAGE_MONITOR
 -      default y
 -      depends on PROC_FS && MMU
 -      bool "Enable /proc page monitoring" if EMBEDDED
 -      help
 -        Various /proc files exist to monitor process memory utilization:
 -        /proc/pid/smaps, /proc/pid/clear_refs, /proc/pid/pagemap,
 -        /proc/kpagecount, and /proc/kpageflags. Disabling these
 -          interfaces will reduce the size of the kernel by approximately 4kb.
 -
  endmenu               # General setup
  
  config HAVE_GENERIC_DMA_COHERENT
diff --combined init/main.c
@@@ -27,7 -27,6 +27,7 @@@
  #include <linux/gfp.h>
  #include <linux/percpu.h>
  #include <linux/kmod.h>
 +#include <linux/vmalloc.h>
  #include <linux/kernel_stat.h>
  #include <linux/start_kernel.h>
  #include <linux/security.h>
@@@ -61,6 -60,7 +61,7 @@@
  #include <linux/sched.h>
  #include <linux/signal.h>
  #include <linux/idr.h>
+ #include <linux/ftrace.h>
  
  #include <asm/io.h>
  #include <asm/bugs.h>
@@@ -643,7 -643,6 +644,7 @@@ asmlinkage void __init start_kernel(voi
                initrd_start = 0;
        }
  #endif
 +      vmalloc_init();
        vfs_caches_init_early();
        cpuset_init_early();
        mem_init();
  
        acpi_early_init(); /* before LAPIC and SMP init */
  
+       ftrace_init();
        /* Do the rest non-__init'ed, we're now alive */
        rest_init();
  }
@@@ -705,30 -706,31 +708,31 @@@ __setup("initcall_debug", initcall_debu
  int do_one_initcall(initcall_t fn)
  {
        int count = preempt_count();
-       ktime_t t0, t1, delta;
+       ktime_t delta;
        char msgbuf[64];
-       int result;
+       struct boot_trace it;
  
        if (initcall_debug) {
-               printk("calling  %pF @ %i\n", fn, task_pid_nr(current));
-               t0 = ktime_get();
+               it.caller = task_pid_nr(current);
+               printk("calling  %pF @ %i\n", fn, it.caller);
+               it.calltime = ktime_get();
        }
  
-       result = fn();
+       it.result = fn();
  
        if (initcall_debug) {
-               t1 = ktime_get();
-               delta = ktime_sub(t1, t0);
-               printk("initcall %pF returned %d after %Ld msecs\n",
-                       fn, result,
-                       (unsigned long long) delta.tv64 >> 20);
+               it.rettime = ktime_get();
+               delta = ktime_sub(it.rettime, it.calltime);
+               it.duration = (unsigned long long) delta.tv64 >> 10;
+               printk("initcall %pF returned %d after %Ld usecs\n", fn,
+                       it.result, it.duration);
+               trace_boot(&it, fn);
        }
  
        msgbuf[0] = 0;
  
-       if (result && result != -ENODEV && initcall_debug)
-               sprintf(msgbuf, "error code %d ", result);
+       if (it.result && it.result != -ENODEV && initcall_debug)
+               sprintf(msgbuf, "error code %d ", it.result);
  
        if (preempt_count() != count) {
                strlcat(msgbuf, "preemption imbalance ", sizeof(msgbuf));
                printk("initcall %pF returned with %s\n", fn, msgbuf);
        }
  
-       return result;
+       return it.result;
  }
  
  
@@@ -857,6 -859,7 +861,7 @@@ static int __init kernel_init(void * un
        smp_prepare_cpus(setup_max_cpus);
  
        do_pre_smp_initcalls();
+       start_boot_trace();
  
        smp_init();
        sched_init_smp();
         * we're essentially up and running. Get rid of the
         * initmem segments and start the user-mode stuff..
         */
+       stop_boot_trace();
        init_post();
        return 0;
  }
diff --combined kernel/Makefile
@@@ -24,7 -24,6 +24,7 @@@ CFLAGS_REMOVE_sched_clock.o = -p
  CFLAGS_REMOVE_sched.o = -mno-spe -pg
  endif
  
 +obj-$(CONFIG_FREEZER) += freezer.o
  obj-$(CONFIG_PROFILING) += profile.o
  obj-$(CONFIG_SYSCTL_SYSCALL_CHECK) += sysctl_check.o
  obj-$(CONFIG_STACKTRACE) += stacktrace.o
@@@ -56,7 -55,6 +56,7 @@@ obj-$(CONFIG_BACKTRACE_SELF_TEST) += ba
  obj-$(CONFIG_COMPAT) += compat.o
  obj-$(CONFIG_CGROUPS) += cgroup.o
  obj-$(CONFIG_CGROUP_DEBUG) += cgroup_debug.o
 +obj-$(CONFIG_CGROUP_FREEZER) += cgroup_freezer.o
  obj-$(CONFIG_CPUSETS) += cpuset.o
  obj-$(CONFIG_CGROUP_NS) += ns_cgroup.o
  obj-$(CONFIG_UTS_NS) += utsname.o
@@@ -85,6 -83,7 +85,7 @@@ obj-$(CONFIG_SYSCTL) += utsname_sysctl.
  obj-$(CONFIG_TASK_DELAY_ACCT) += delayacct.o
  obj-$(CONFIG_TASKSTATS) += taskstats.o tsacct.o
  obj-$(CONFIG_MARKERS) += marker.o
+ obj-$(CONFIG_TRACEPOINTS) += tracepoint.o
  obj-$(CONFIG_LATENCYTOP) += latencytop.o
  obj-$(CONFIG_HAVE_GENERIC_DMA_COHERENT) += dma-coherent.o
  obj-$(CONFIG_FTRACE) += trace/
diff --combined kernel/exit.c
@@@ -47,6 -47,7 +47,7 @@@
  #include <linux/blkdev.h>
  #include <linux/task_io_accounting_ops.h>
  #include <linux/tracehook.h>
+ #include <trace/sched.h>
  
  #include <asm/uaccess.h>
  #include <asm/unistd.h>
@@@ -112,6 -113,8 +113,6 @@@ static void __exit_signal(struct task_s
                 * We won't ever get here for the group leader, since it
                 * will have been the last reference on the signal_struct.
                 */
 -              sig->utime = cputime_add(sig->utime, task_utime(tsk));
 -              sig->stime = cputime_add(sig->stime, task_stime(tsk));
                sig->gtime = cputime_add(sig->gtime, task_gtime(tsk));
                sig->min_flt += tsk->min_flt;
                sig->maj_flt += tsk->maj_flt;
                sig->inblock += task_io_get_inblock(tsk);
                sig->oublock += task_io_get_oublock(tsk);
                task_io_accounting_add(&sig->ioac, &tsk->ioac);
 -              sig->sum_sched_runtime += tsk->se.sum_exec_runtime;
                sig = NULL; /* Marker for below. */
        }
  
  
  static void delayed_put_task_struct(struct rcu_head *rhp)
  {
-       put_task_struct(container_of(rhp, struct task_struct, rcu));
+       struct task_struct *tsk = container_of(rhp, struct task_struct, rcu);
+       trace_sched_process_free(tsk);
+       put_task_struct(tsk);
  }
  
  
@@@ -637,23 -644,24 +641,23 @@@ retry
  assign_new_owner:
        BUG_ON(c == p);
        get_task_struct(c);
 +      read_unlock(&tasklist_lock);
 +      down_write(&mm->mmap_sem);
        /*
         * The task_lock protects c->mm from changing.
         * We always want mm->owner->mm == mm
         */
        task_lock(c);
 -      /*
 -       * Delay read_unlock() till we have the task_lock()
 -       * to ensure that c does not slip away underneath us
 -       */
 -      read_unlock(&tasklist_lock);
        if (c->mm != mm) {
                task_unlock(c);
 +              up_write(&mm->mmap_sem);
                put_task_struct(c);
                goto retry;
        }
        cgroup_mm_owner_callbacks(mm->owner, c);
        mm->owner = c;
        task_unlock(c);
 +      up_write(&mm->mmap_sem);
        put_task_struct(c);
  }
  #endif /* CONFIG_MM_OWNER */
@@@ -1070,6 -1078,8 +1074,8 @@@ NORET_TYPE void do_exit(long code
  
        if (group_dead)
                acct_process();
+       trace_sched_process_exit(tsk);
        exit_sem(tsk);
        exit_files(tsk);
        exit_fs(tsk);
@@@ -1298,7 -1308,6 +1304,7 @@@ static int wait_task_zombie(struct task
        if (likely(!traced)) {
                struct signal_struct *psig;
                struct signal_struct *sig;
 +              struct task_cputime cputime;
  
                /*
                 * The resource counters for the group leader are in its
                 * need to protect the access to p->parent->signal fields,
                 * as other threads in the parent group can be right
                 * here reaping other children at the same time.
 +               *
 +               * We use thread_group_cputime() to get times for the thread
 +               * group, which consolidates times for all threads in the
 +               * group including the group leader.
                 */
                spin_lock_irq(&p->parent->sighand->siglock);
                psig = p->parent->signal;
                sig = p->signal;
 +              thread_group_cputime(p, &cputime);
                psig->cutime =
                        cputime_add(psig->cutime,
 -                      cputime_add(p->utime,
 -                      cputime_add(sig->utime,
 -                                  sig->cutime)));
 +                      cputime_add(cputime.utime,
 +                                  sig->cutime));
                psig->cstime =
                        cputime_add(psig->cstime,
 -                      cputime_add(p->stime,
 -                      cputime_add(sig->stime,
 -                                  sig->cstime)));
 +                      cputime_add(cputime.stime,
 +                                  sig->cstime));
                psig->cgtime =
                        cputime_add(psig->cgtime,
                        cputime_add(p->gtime,
@@@ -1675,6 -1681,8 +1681,8 @@@ static long do_wait(enum pid_type type
        struct task_struct *tsk;
        int retval;
  
+       trace_sched_process_wait(pid);
        add_wait_queue(&current->signal->wait_chldexit,&wait);
  repeat:
        /*
diff --combined kernel/fork.c
@@@ -58,6 -58,7 +58,7 @@@
  #include <linux/tty.h>
  #include <linux/proc_fs.h>
  #include <linux/blkdev.h>
+ #include <trace/sched.h>
  
  #include <asm/pgtable.h>
  #include <asm/pgalloc.h>
@@@ -759,44 -760,15 +760,44 @@@ void __cleanup_sighand(struct sighand_s
                kmem_cache_free(sighand_cachep, sighand);
  }
  
 +
 +/*
 + * Initialize POSIX timer handling for a thread group.
 + */
 +static void posix_cpu_timers_init_group(struct signal_struct *sig)
 +{
 +      /* Thread group counters. */
 +      thread_group_cputime_init(sig);
 +
 +      /* Expiration times and increments. */
 +      sig->it_virt_expires = cputime_zero;
 +      sig->it_virt_incr = cputime_zero;
 +      sig->it_prof_expires = cputime_zero;
 +      sig->it_prof_incr = cputime_zero;
 +
 +      /* Cached expiration times. */
 +      sig->cputime_expires.prof_exp = cputime_zero;
 +      sig->cputime_expires.virt_exp = cputime_zero;
 +      sig->cputime_expires.sched_exp = 0;
 +
 +      /* The timer lists. */
 +      INIT_LIST_HEAD(&sig->cpu_timers[0]);
 +      INIT_LIST_HEAD(&sig->cpu_timers[1]);
 +      INIT_LIST_HEAD(&sig->cpu_timers[2]);
 +}
 +
  static int copy_signal(unsigned long clone_flags, struct task_struct *tsk)
  {
        struct signal_struct *sig;
        int ret;
  
        if (clone_flags & CLONE_THREAD) {
 -              atomic_inc(&current->signal->count);
 -              atomic_inc(&current->signal->live);
 -              return 0;
 +              ret = thread_group_cputime_clone_thread(current);
 +              if (likely(!ret)) {
 +                      atomic_inc(&current->signal->count);
 +                      atomic_inc(&current->signal->live);
 +              }
 +              return ret;
        }
        sig = kmem_cache_alloc(signal_cachep, GFP_KERNEL);
        tsk->signal = sig;
        sig->it_real_incr.tv64 = 0;
        sig->real_timer.function = it_real_fn;
  
 -      sig->it_virt_expires = cputime_zero;
 -      sig->it_virt_incr = cputime_zero;
 -      sig->it_prof_expires = cputime_zero;
 -      sig->it_prof_incr = cputime_zero;
 -
        sig->leader = 0;        /* session leadership doesn't inherit */
        sig->tty_old_pgrp = NULL;
        sig->tty = NULL;
  
 -      sig->utime = sig->stime = sig->cutime = sig->cstime = cputime_zero;
 +      sig->cutime = sig->cstime = cputime_zero;
        sig->gtime = cputime_zero;
        sig->cgtime = cputime_zero;
        sig->nvcsw = sig->nivcsw = sig->cnvcsw = sig->cnivcsw = 0;
        sig->min_flt = sig->maj_flt = sig->cmin_flt = sig->cmaj_flt = 0;
        sig->inblock = sig->oublock = sig->cinblock = sig->coublock = 0;
        task_io_accounting_init(&sig->ioac);
 -      sig->sum_sched_runtime = 0;
 -      INIT_LIST_HEAD(&sig->cpu_timers[0]);
 -      INIT_LIST_HEAD(&sig->cpu_timers[1]);
 -      INIT_LIST_HEAD(&sig->cpu_timers[2]);
        taskstats_tgid_init(sig);
  
        task_lock(current->group_leader);
        memcpy(sig->rlim, current->signal->rlim, sizeof sig->rlim);
        task_unlock(current->group_leader);
  
 -      if (sig->rlim[RLIMIT_CPU].rlim_cur != RLIM_INFINITY) {
 -              /*
 -               * New sole thread in the process gets an expiry time
 -               * of the whole CPU time limit.
 -               */
 -              tsk->it_prof_expires =
 -                      secs_to_cputime(sig->rlim[RLIMIT_CPU].rlim_cur);
 -      }
 +      posix_cpu_timers_init_group(sig);
 +
        acct_init_pacct(&sig->pacct);
  
        tty_audit_fork(sig);
  
  void __cleanup_signal(struct signal_struct *sig)
  {
 +      thread_group_cputime_free(sig);
        exit_thread_group_keys(sig);
        tty_kref_put(sig->tty);
        kmem_cache_free(signal_cachep, sig);
@@@ -903,19 -889,6 +904,19 @@@ void mm_init_owner(struct mm_struct *mm
  #endif /* CONFIG_MM_OWNER */
  
  /*
 + * Initialize POSIX timer handling for a single task.
 + */
 +static void posix_cpu_timers_init(struct task_struct *tsk)
 +{
 +      tsk->cputime_expires.prof_exp = cputime_zero;
 +      tsk->cputime_expires.virt_exp = cputime_zero;
 +      tsk->cputime_expires.sched_exp = 0;
 +      INIT_LIST_HEAD(&tsk->cpu_timers[0]);
 +      INIT_LIST_HEAD(&tsk->cpu_timers[1]);
 +      INIT_LIST_HEAD(&tsk->cpu_timers[2]);
 +}
 +
 +/*
   * This creates a new process as a copy of the old one,
   * but does not actually start it yet.
   *
@@@ -1025,7 -998,12 +1026,7 @@@ static struct task_struct *copy_process
        task_io_accounting_init(&p->ioac);
        acct_clear_integrals(p);
  
 -      p->it_virt_expires = cputime_zero;
 -      p->it_prof_expires = cputime_zero;
 -      p->it_sched_expires = 0;
 -      INIT_LIST_HEAD(&p->cpu_timers[0]);
 -      INIT_LIST_HEAD(&p->cpu_timers[1]);
 -      INIT_LIST_HEAD(&p->cpu_timers[2]);
 +      posix_cpu_timers_init(p);
  
        p->lock_depth = -1;             /* -1 = no lock */
        do_posix_clock_monotonic_gettime(&p->start_time);
        if (clone_flags & CLONE_THREAD) {
                p->group_leader = current->group_leader;
                list_add_tail_rcu(&p->thread_group, &p->group_leader->thread_group);
 -
 -              if (!cputime_eq(current->signal->it_virt_expires,
 -                              cputime_zero) ||
 -                  !cputime_eq(current->signal->it_prof_expires,
 -                              cputime_zero) ||
 -                  current->signal->rlim[RLIMIT_CPU].rlim_cur != RLIM_INFINITY ||
 -                  !list_empty(&current->signal->cpu_timers[0]) ||
 -                  !list_empty(&current->signal->cpu_timers[1]) ||
 -                  !list_empty(&current->signal->cpu_timers[2])) {
 -                      /*
 -                       * Have child wake up on its first tick to check
 -                       * for process CPU timers.
 -                       */
 -                      p->it_prof_expires = jiffies_to_cputime(1);
 -              }
        }
  
        if (likely(p->pid)) {
@@@ -1372,6 -1365,8 +1373,8 @@@ long do_fork(unsigned long clone_flags
        if (!IS_ERR(p)) {
                struct completion vfork;
  
+               trace_sched_process_fork(current, p);
                nr = task_pid_vnr(p);
  
                if (clone_flags & CLONE_PARENT_SETTID)
diff --combined kernel/kthread.c
@@@ -13,6 -13,7 +13,7 @@@
  #include <linux/file.h>
  #include <linux/module.h>
  #include <linux/mutex.h>
+ #include <trace/sched.h>
  
  #define KTHREAD_NICE_LEVEL (-5)
  
@@@ -171,11 -172,12 +172,11 @@@ EXPORT_SYMBOL(kthread_create)
   */
  void kthread_bind(struct task_struct *k, unsigned int cpu)
  {
 -      if (k->state != TASK_UNINTERRUPTIBLE) {
 +      /* Must have done schedule() in kthread() before we set_task_cpu */
 +      if (!wait_task_inactive(k, TASK_UNINTERRUPTIBLE)) {
                WARN_ON(1);
                return;
        }
 -      /* Must have done schedule() in kthread() before we set_task_cpu */
 -      wait_task_inactive(k, 0);
        set_task_cpu(k, cpu);
        k->cpus_allowed = cpumask_of_cpu(cpu);
        k->rt.nr_cpus_allowed = 1;
@@@ -205,6 -207,8 +206,8 @@@ int kthread_stop(struct task_struct *k
        /* It could exit after stop_info.k set, but before wake_up_process. */
        get_task_struct(k);
  
+       trace_sched_kthread_stop(k);
        /* Must init completion *before* thread sees kthread_stop_info.k */
        init_completion(&kthread_stop_info.done);
        smp_wmb();
        ret = kthread_stop_info.err;
        mutex_unlock(&kthread_stop_lock);
  
+       trace_sched_kthread_stop_ret(ret);
        return ret;
  }
  EXPORT_SYMBOL(kthread_stop);
diff --combined kernel/module.c
@@@ -46,6 -46,8 +46,8 @@@
  #include <asm/cacheflush.h>
  #include <linux/license.h>
  #include <asm/sections.h>
+ #include <linux/tracepoint.h>
+ #include <linux/ftrace.h>
  
  #if 0
  #define DEBUGP printk
@@@ -100,7 -102,7 +102,7 @@@ static inline int strong_try_module_get
  static inline void add_taint_module(struct module *mod, unsigned flag)
  {
        add_taint(flag);
 -      mod->taints |= flag;
 +      mod->taints |= (1U << flag);
  }
  
  /*
@@@ -784,7 -786,6 +786,7 @@@ sys_delete_module(const char __user *na
        mutex_lock(&module_mutex);
        /* Store the name of the last unloaded module for diagnostic purposes */
        strlcpy(last_unloaded_module, mod->name, sizeof(last_unloaded_module));
 +      unregister_dynamic_debug_module(mod->name);
        free_module(mod);
  
   out:
@@@ -924,7 -925,7 +926,7 @@@ static const char vermagic[] = VERMAGIC
  static int try_to_force_load(struct module *mod, const char *symname)
  {
  #ifdef CONFIG_MODULE_FORCE_LOAD
 -      if (!(tainted & TAINT_FORCED_MODULE))
 +      if (!test_taint(TAINT_FORCED_MODULE))
                printk("%s: no version for \"%s\" found: kernel tainted.\n",
                       mod->name, symname);
        add_taint_module(mod, TAINT_FORCED_MODULE);
@@@ -1034,7 -1035,7 +1036,7 @@@ static unsigned long resolve_symbol(Elf
        const unsigned long *crc;
  
        ret = find_symbol(name, &owner, &crc,
 -                        !(mod->taints & TAINT_PROPRIETARY_MODULE), true);
 +                        !(mod->taints & (1 << TAINT_PROPRIETARY_MODULE)), true);
        if (!IS_ERR_VALUE(ret)) {
                /* use_module can fail due to OOM,
                   or module initialization or unloading */
@@@ -1174,7 -1175,7 +1176,7 @@@ static void free_notes_attrs(struct mod
                while (i-- > 0)
                        sysfs_remove_bin_file(notes_attrs->dir,
                                              &notes_attrs->attrs[i]);
 -              kobject_del(notes_attrs->dir);
 +              kobject_put(notes_attrs->dir);
        }
        kfree(notes_attrs);
  }
@@@ -1430,6 -1431,9 +1432,9 @@@ static void free_module(struct module *
        /* Module unload stuff */
        module_unload_free(mod);
  
+       /* release any pointers to mcount in this module */
+       ftrace_release(mod->module_core, mod->core_size);
        /* This may be NULL, but that's OK */
        module_free(mod, mod->module_init);
        kfree(mod->args);
@@@ -1635,7 -1639,7 +1640,7 @@@ static void set_license(struct module *
                license = "unspecified";
  
        if (!license_is_gpl_compatible(license)) {
 -              if (!(tainted & TAINT_PROPRIETARY_MODULE))
 +              if (!test_taint(TAINT_PROPRIETARY_MODULE))
                        printk(KERN_WARNING "%s: module license '%s' taints "
                                "kernel.\n", mod->name, license);
                add_taint_module(mod, TAINT_PROPRIETARY_MODULE);
@@@ -1784,33 -1788,6 +1789,33 @@@ static inline void add_kallsyms(struct 
  }
  #endif /* CONFIG_KALLSYMS */
  
 +#ifdef CONFIG_DYNAMIC_PRINTK_DEBUG
 +static void dynamic_printk_setup(Elf_Shdr *sechdrs, unsigned int verboseindex)
 +{
 +      struct mod_debug *debug_info;
 +      unsigned long pos, end;
 +      unsigned int num_verbose;
 +
 +      pos = sechdrs[verboseindex].sh_addr;
 +      num_verbose = sechdrs[verboseindex].sh_size /
 +                              sizeof(struct mod_debug);
 +      end = pos + (num_verbose * sizeof(struct mod_debug));
 +
 +      for (; pos < end; pos += sizeof(struct mod_debug)) {
 +              debug_info = (struct mod_debug *)pos;
 +              register_dynamic_debug_module(debug_info->modname,
 +                      debug_info->type, debug_info->logical_modname,
 +                      debug_info->flag_names, debug_info->hash,
 +                      debug_info->hash2);
 +      }
 +}
 +#else
 +static inline void dynamic_printk_setup(Elf_Shdr *sechdrs,
 +                                      unsigned int verboseindex)
 +{
 +}
 +#endif /* CONFIG_DYNAMIC_PRINTK_DEBUG */
 +
  static void *module_alloc_update_bounds(unsigned long size)
  {
        void *ret = module_alloc(size);
@@@ -1834,7 -1811,6 +1839,7 @@@ static noinline struct module *load_mod
        Elf_Ehdr *hdr;
        Elf_Shdr *sechdrs;
        char *secstrings, *args, *modmagic, *strtab = NULL;
 +      char *staging;
        unsigned int i;
        unsigned int symindex = 0;
        unsigned int strindex = 0;
  #endif
        unsigned int markersindex;
        unsigned int markersstringsindex;
 +      unsigned int verboseindex;
+       unsigned int tracepointsindex;
+       unsigned int tracepointsstringsindex;
+       unsigned int mcountindex;
        struct module *mod;
        long err = 0;
        void *percpu = NULL, *ptr = NULL; /* Stops spurious gcc warning */
+       void *mseg;
        struct exception_table_entry *extable;
        mm_segment_t old_fs;
  
                goto free_hdr;
        }
  
 +      staging = get_modinfo(sechdrs, infoindex, "staging");
 +      if (staging) {
 +              add_taint_module(mod, TAINT_CRAP);
 +              printk(KERN_WARNING "%s: module is from the staging directory,"
 +                     " the quality is unknown, you have been warned.\n",
 +                     mod->name);
 +      }
 +
        /* Now copy in args */
        args = strndup_user(uargs, ~0UL >> 1);
        if (IS_ERR(args)) {
        markersindex = find_sec(hdr, sechdrs, secstrings, "__markers");
        markersstringsindex = find_sec(hdr, sechdrs, secstrings,
                                        "__markers_strings");
 +      verboseindex = find_sec(hdr, sechdrs, secstrings, "__verbose");
+       tracepointsindex = find_sec(hdr, sechdrs, secstrings, "__tracepoints");
+       tracepointsstringsindex = find_sec(hdr, sechdrs, secstrings,
+                                       "__tracepoints_strings");
+       mcountindex = find_sec(hdr, sechdrs, secstrings,
+                              "__mcount_loc");
  
        /* Now do relocations. */
        for (i = 1; i < hdr->e_shnum; i++) {
        mod->num_markers =
                sechdrs[markersindex].sh_size / sizeof(*mod->markers);
  #endif
+ #ifdef CONFIG_TRACEPOINTS
+       mod->tracepoints = (void *)sechdrs[tracepointsindex].sh_addr;
+       mod->num_tracepoints =
+               sechdrs[tracepointsindex].sh_size / sizeof(*mod->tracepoints);
+ #endif
  
          /* Find duplicate symbols */
        err = verify_export_symbols(mod);
  
        add_kallsyms(mod, sechdrs, symindex, strindex, secstrings);
  
+       if (!mod->taints) {
  #ifdef CONFIG_MARKERS
                marker_update_probe_range(mod->markers,
                        mod->markers + mod->num_markers);
  #endif
 +      dynamic_printk_setup(sechdrs, verboseindex);
+ #ifdef CONFIG_TRACEPOINTS
+               tracepoint_update_probe_range(mod->tracepoints,
+                       mod->tracepoints + mod->num_tracepoints);
+ #endif
+       }
+       /* sechdrs[0].sh_size is always zero */
+       mseg = (void *)sechdrs[mcountindex].sh_addr;
+       ftrace_init_module(mseg, mseg + sechdrs[mcountindex].sh_size);
        err = module_finalize(hdr, sechdrs, mod);
        if (err < 0)
                goto cleanup;
   cleanup:
        kobject_del(&mod->mkobj.kobj);
        kobject_put(&mod->mkobj.kobj);
+       ftrace_release(mod->module_core, mod->core_size);
   free_unload:
        module_unload_free(mod);
        module_free(mod, mod->module_init);
@@@ -2592,12 -2584,10 +2624,12 @@@ static char *module_flags(struct modul
            mod->state == MODULE_STATE_GOING ||
            mod->state == MODULE_STATE_COMING) {
                buf[bx++] = '(';
 -              if (mod->taints & TAINT_PROPRIETARY_MODULE)
 +              if (mod->taints & (1 << TAINT_PROPRIETARY_MODULE))
                        buf[bx++] = 'P';
 -              if (mod->taints & TAINT_FORCED_MODULE)
 +              if (mod->taints & (1 << TAINT_FORCED_MODULE))
                        buf[bx++] = 'F';
 +              if (mod->taints & (1 << TAINT_CRAP))
 +                      buf[bx++] = 'C';
                /*
                 * TAINT_FORCED_RMMOD: could be added.
                 * TAINT_UNSAFE_SMP, TAINT_MACHINE_CHECK, TAINT_BAD_PAGE don't
@@@ -2759,3 -2749,50 +2791,50 @@@ void module_update_markers(void
        mutex_unlock(&module_mutex);
  }
  #endif
+ #ifdef CONFIG_TRACEPOINTS
+ void module_update_tracepoints(void)
+ {
+       struct module *mod;
+       mutex_lock(&module_mutex);
+       list_for_each_entry(mod, &modules, list)
+               if (!mod->taints)
+                       tracepoint_update_probe_range(mod->tracepoints,
+                               mod->tracepoints + mod->num_tracepoints);
+       mutex_unlock(&module_mutex);
+ }
+ /*
+  * Returns 0 if current not found.
+  * Returns 1 if current found.
+  */
+ int module_get_iter_tracepoints(struct tracepoint_iter *iter)
+ {
+       struct module *iter_mod;
+       int found = 0;
+       mutex_lock(&module_mutex);
+       list_for_each_entry(iter_mod, &modules, list) {
+               if (!iter_mod->taints) {
+                       /*
+                        * Sorted module list
+                        */
+                       if (iter_mod < iter->module)
+                               continue;
+                       else if (iter_mod > iter->module)
+                               iter->tracepoint = NULL;
+                       found = tracepoint_get_iter_range(&iter->tracepoint,
+                               iter_mod->tracepoints,
+                               iter_mod->tracepoints
+                                       + iter_mod->num_tracepoints);
+                       if (found) {
+                               iter->module = iter_mod;
+                               break;
+                       }
+               }
+       }
+       mutex_unlock(&module_mutex);
+       return found;
+ }
+ #endif
diff --combined kernel/sched.c
@@@ -71,6 -71,7 +71,7 @@@
  #include <linux/debugfs.h>
  #include <linux/ctype.h>
  #include <linux/ftrace.h>
+ #include <trace/sched.h>
  
  #include <asm/tlb.h>
  #include <asm/irq_regs.h>
@@@ -1936,6 -1937,7 +1937,7 @@@ unsigned long wait_task_inactive(struc
                 * just go back and repeat.
                 */
                rq = task_rq_lock(p, &flags);
+               trace_sched_wait_task(rq, p);
                running = task_running(rq, p);
                on_rq = p->se.on_rq;
                ncsw = 0;
@@@ -2297,9 -2299,7 +2299,7 @@@ out_activate
        success = 1;
  
  out_running:
-       trace_mark(kernel_sched_wakeup,
-               "pid %d state %ld ## rq %p task %p rq->curr %p",
-               p->pid, p->state, rq, p, rq->curr);
+       trace_sched_wakeup(rq, p);
        check_preempt_curr(rq, p, sync);
  
        p->state = TASK_RUNNING;
@@@ -2432,9 -2432,7 +2432,7 @@@ void wake_up_new_task(struct task_struc
                p->sched_class->task_new(rq, p);
                inc_nr_running(rq);
        }
-       trace_mark(kernel_sched_wakeup_new,
-               "pid %d state %ld ## rq %p task %p rq->curr %p",
-               p->pid, p->state, rq, p, rq->curr);
+       trace_sched_wakeup_new(rq, p);
        check_preempt_curr(rq, p, 0);
  #ifdef CONFIG_SMP
        if (p->sched_class->task_wake_up)
@@@ -2607,11 -2605,7 +2605,7 @@@ context_switch(struct rq *rq, struct ta
        struct mm_struct *mm, *oldmm;
  
        prepare_task_switch(rq, prev, next);
-       trace_mark(kernel_sched_schedule,
-               "prev_pid %d next_pid %d prev_state %ld "
-               "## rq %p prev %p next %p",
-               prev->pid, next->pid, prev->state,
-               rq, prev, next);
+       trace_sched_switch(rq, prev, next);
        mm = next->mm;
        oldmm = prev->active_mm;
        /*
@@@ -2851,6 -2845,7 +2845,7 @@@ static void sched_migrate_task(struct t
            || unlikely(!cpu_active(dest_cpu)))
                goto out;
  
+       trace_sched_migrate_task(rq, p, dest_cpu);
        /* force the process onto the specified CPU */
        if (migrate_task(p, dest_cpu, &req)) {
                /* Need to wait for migration thread (might exit: take ref). */
@@@ -4052,26 -4047,23 +4047,26 @@@ DEFINE_PER_CPU(struct kernel_stat, ksta
  EXPORT_PER_CPU_SYMBOL(kstat);
  
  /*
 - * Return p->sum_exec_runtime plus any more ns on the sched_clock
 - * that have not yet been banked in case the task is currently running.
 + * Return any ns on the sched_clock that have not yet been banked in
 + * @p in case that task is currently running.
   */
 -unsigned long long task_sched_runtime(struct task_struct *p)
 +unsigned long long task_delta_exec(struct task_struct *p)
  {
        unsigned long flags;
 -      u64 ns, delta_exec;
        struct rq *rq;
 +      u64 ns = 0;
  
        rq = task_rq_lock(p, &flags);
 -      ns = p->se.sum_exec_runtime;
 +
        if (task_current(rq, p)) {
 +              u64 delta_exec;
 +
                update_rq_clock(rq);
                delta_exec = rq->clock - p->se.exec_start;
                if ((s64)delta_exec > 0)
 -                      ns += delta_exec;
 +                      ns = delta_exec;
        }
 +
        task_rq_unlock(rq, &flags);
  
        return ns;
@@@ -4088,7 -4080,6 +4083,7 @@@ void account_user_time(struct task_stru
        cputime64_t tmp;
  
        p->utime = cputime_add(p->utime, cputime);
 +      account_group_user_time(p, cputime);
  
        /* Add user time to cpustat. */
        tmp = cputime_to_cputime64(cputime);
@@@ -4113,7 -4104,6 +4108,7 @@@ static void account_guest_time(struct t
        tmp = cputime_to_cputime64(cputime);
  
        p->utime = cputime_add(p->utime, cputime);
 +      account_group_user_time(p, cputime);
        p->gtime = cputime_add(p->gtime, cputime);
  
        cpustat->user = cputime64_add(cpustat->user, tmp);
@@@ -4149,7 -4139,6 +4144,7 @@@ void account_system_time(struct task_st
        }
  
        p->stime = cputime_add(p->stime, cputime);
 +      account_group_system_time(p, cputime);
  
        /* Add system time to cpustat. */
        tmp = cputime_to_cputime64(cputime);
@@@ -4191,7 -4180,6 +4186,7 @@@ void account_steal_time(struct task_str
  
        if (p == rq->idle) {
                p->stime = cputime_add(p->stime, steal);
 +              account_group_system_time(p, steal);
                if (atomic_read(&rq->nr_iowait) > 0)
                        cpustat->iowait = cputime64_add(cpustat->iowait, tmp);
                else
diff --combined kernel/signal.c
@@@ -27,6 -27,7 +27,7 @@@
  #include <linux/freezer.h>
  #include <linux/pid_namespace.h>
  #include <linux/nsproxy.h>
+ #include <trace/sched.h>
  
  #include <asm/param.h>
  #include <asm/uaccess.h>
@@@ -803,6 -804,8 +804,8 @@@ static int send_signal(int sig, struct 
        struct sigpending *pending;
        struct sigqueue *q;
  
+       trace_sched_signal_send(sig, t);
        assert_spin_locked(&t->sighand->siglock);
        if (!prepare_signal(sig, t))
                return 0;
@@@ -1338,7 -1341,6 +1341,7 @@@ int do_notify_parent(struct task_struc
        struct siginfo info;
        unsigned long flags;
        struct sighand_struct *psig;
 +      struct task_cputime cputime;
        int ret = sig;
  
        BUG_ON(sig == -1);
  
        info.si_uid = tsk->uid;
  
 -      info.si_utime = cputime_to_clock_t(cputime_add(tsk->utime,
 -                                                     tsk->signal->utime));
 -      info.si_stime = cputime_to_clock_t(cputime_add(tsk->stime,
 -                                                     tsk->signal->stime));
 +      thread_group_cputime(tsk, &cputime);
 +      info.si_utime = cputime_to_jiffies(cputime.utime);
 +      info.si_stime = cputime_to_jiffies(cputime.stime);
  
        info.si_status = tsk->exit_code & 0x7f;
        if (tsk->exit_code & 0x80)