scheduler changes for v4.11
Subsystems (38)
Linus,
Please pull the latest sched-core-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git sched-core-for-linus
# HEAD: bb3bac2ca9a3a5b7fa601781adf70167a0449d75 sched/core: Remove unlikely() annotation from sched_move_task()
The main changes in this (fairly busy) cycle were:
- There was a class of scheduler bugs related to forgetting to update the rq-clock timestamp which can cause weird and hard to debug problems, so there's a new debug facility for this: which uncovered a whole lot of bugs which convinced us that we want to keep the debug facility.
(Peter Zijlstra, Matt Fleming)
- Various cputime related updates: eliminate cputime and use u64 nanoseconds directly, simplify and improve the arch interfaces, implement delayed accounting more widely, etc. - (Frederic Weisbecker)
- Move code around for better structure plus cleanups (Ingo Molnar)
- Move IO schedule accounting deeper into the scheduler plus related changes to improve the situation (Tejun Heo)
- ... plus a round of sched/rt and sched/deadline fixes, plus other fixes, updats and cleanups.
Thanks,
Ingo
------------------>
Dietmar Eggemann (1):
sched/fair: Explain why MIN_SHARES isn't scaled in calc_cfs_shares()
Frederic Weisbecker (45):
sched/cputime, powerpc32: Fix stale scaled stime on context switch sched/cputime, ia64: Fix incorrect start cputime assignment on task switch sched/cputime: Allow accounting system time using cpustat index sched/cputime: Export account_guest_time()
sched/cputime, powerpc: Prepare accounting structure for cputime flush on tick sched/cputime, powerpc: Migrate stolen_time field to the accounting structure sched/cputime, powerpc/vtime: Accumulate cputime and account only on tick/task switch sched/cputime, ia64: Accumulate cputime and account only on tick/task switch sched/cputime: Rename vtime_account_user() to vtime_flush()
jiffies: Reuse TICK_NSEC instead of NSEC_PER_JIFFY
time: Introduce jiffies64_to_nsecs()
sched/cputime: Remove the unused INIT_CPUTIME macro
sched/cputime: Convert kcpustat to nsecs
macintosh/rack-meter: Convert cputime64_t use to u64
sched/cputime: Convert guest time accounting to nsecs (u64) sched/cputime: Introduce special task_cputime_t() API to return old-typed cputime sched/cputime: Convert task/group cputime to nsecs
alpha: Convert obsolete cputime_t to nsecs
x86: Convert obsolete cputime type to nsecs
isdn: Convert obsolete cputime type to nsecs
fs/binfmt: Convert obsolete cputime type to nsecs
acct: Convert obsolete cputime type to nsecs
delaycct: Convert obsolete cputime type to nsecs
tsacct: Convert obsolete cputime type to nsecs
signal: Convert obsolete cputime type to nsecs
sched/cputime: Increment kcpustat directly on irqtime account timers/posix-timers: Use TICK_NSEC instead of a dynamically ad-hoc calculated version timers/posix-timers: Convert internals to use nsecs
timers/itimer: Convert internal cputime_t units to nsec
sched/cputime: Remove temporary cputime_t accessors
sched/cputime: Push time to account_user_time() in nsecs sched/cputime: Push time to account_steal_time() in nsecs sched/cputime: Push time to account_idle_time() in nsecs sched/cputime: Push time to account_system_time() in nsecs sched/cputime: Complete nsec conversion of tick based accounting sched/cputime, vtime: Return nsecs instead of cputime_t to account sched/cputime: Remove jiffies based cputime
ia64, sched/cputime: Move the nsecs based cputime headers to the last arch using it
ia64: Convert vtime to use nsec units directly
ia64, sched/cputime: Remove unused cputime definitions
s390, sched/cputime: Make arch_cpu_idle_time() to return nsecs powerpc, sched/cputime: Remove unused cputime definitions
s390, sched/cputime: Remove unused cputime definitions
sched/cputime: Remove unused nsec_to_cputime()
sched/cputime: Remove generic asm headers
Ingo Molnar (7):
locking/mutex, sched/wait: Fix the mutex_lock_io_nested() define sched/core: Clean up comments
delayacct: Include <uapi/linux/taskstats.h>
sched/rq_clock: Consolidate the ordering of the rq_clock methods sched/core: Remove unnecessary #include headers
sched/topology: Split out scheduler topology code from core.c into topology.c sched/autogroup: Rename auto_group.[ch] to autogroup.[ch]
Martin Schwidefsky (1):
sched/cputime, s390: Implement delayed accounting of system time
Mathieu Poirier (2):
sched/core: Fix &rd->rto_mask memory leak
sched/core: Fix &rd->cpudl memory leakMatt Fleming (5):
sched/core: Add wrappers for lockdep_(un)pin_lock() sched/core: Reset RQCF_ACT_SKIP before unpinning rq->lock sched/fair: Push rq lock pin/unpin into idle_balance() sched/core: Add debugging code to catch missing update_rq_clock() calls sched/fair: Restore previous rq_flags when migrating tasks in hotplug
Paul Gortmaker (1):
sched/clock: Add dummy clear_sched_clock_stable() stub function
Peter Zijlstra (11):
sched/core: Add missing update_rq_clock() in post_init_entity_util_avg() sched/core: Add missing update_rq_clock() in detach_task_cfs_rq() sched/core: Add missing update_rq_clock() call for task_hot() sched/core: Add missing update_rq_clock() call in set_user_nice() sched/clock: Update static_key usage
sched/clock: Delay switching sched_clock to stable sched/clock: Provide better clock continuity sched/completions: Fix complete_all() semantics sched/clock: Fix hotplug crash
sched/core: Optimize pick_next_task() for idle_sched_class sched/core: Add missing update_rq_clock() call in sched_move_task()
Sebastian Andrzej Siewior (1):
sched/rt: Add a missing rescheduling point
Shile Zhang (1):
sched/rt: Show the 'sched_rr_timeslice' SCHED_RR timeslice tuning knob in milliseconds
Steven Rostedt (VMware) (1):
sched/core: Remove unlikely() annotation from sched_move_task()
Tejun Heo (4):
sched/core: move IO scheduling accounting from io_schedule_timeout() into scheduler sched/core: Separate out io_schedule_prepare() and io_schedule_finish() locking/mutex, sched/wait: Add mutex_lock_io()
fs/jbd2, locking/mutex, sched/wait: Use mutex_lock_io() for journal->j_checkpoint_mutex
Thomas Gleixner (1):
sched/clock, clocksource: Add optional cs::mark_unstable() method
Tim Chen (1):
sched/x86: Remove unnecessary TBM3 check to update topology
Tommaso Cucinotta (1):
sched/deadline: Show leftover runtime and abs deadline in /proc/*/sched
Vincent Guittot (1):
sched/core: Fix group_entity's share update
Zhou Chengming (1):
sched/Documentation/sched-rt-group: Fix incorrect example
Documentation/scheduler/sched-deadline.txt | 6 +
Documentation/scheduler/sched-rt-group.txt | 8 +-
arch/alpha/include/asm/Kbuild | 1 -
arch/alpha/kernel/osf_sys.c | 10 +-
arch/arc/include/asm/Kbuild | 1 -
arch/arm/include/asm/Kbuild | 1 -
arch/arm64/include/asm/Kbuild | 1 -
arch/avr32/include/asm/Kbuild | 1 -
arch/blackfin/include/asm/Kbuild | 1 -
arch/c6x/include/asm/Kbuild | 1 -
arch/cris/include/asm/Kbuild | 1 -
arch/frv/include/asm/Kbuild | 1 -
arch/h8300/include/asm/Kbuild | 1 -
arch/hexagon/include/asm/Kbuild | 1 -
arch/ia64/include/asm/cputime.h | 6 +-
arch/ia64/include/asm/thread_info.h | 6 +
arch/ia64/kernel/head.S | 4 +-
arch/ia64/kernel/setup.c | 2 +
arch/ia64/kernel/time.c | 69 +-
arch/m32r/include/asm/Kbuild | 1 -
arch/m68k/include/asm/Kbuild | 1 -
arch/metag/include/asm/Kbuild | 1 -
arch/microblaze/include/asm/Kbuild | 1 -
arch/mips/include/asm/Kbuild | 1 -
arch/mips/kernel/binfmt_elfn32.c | 12 +-
arch/mips/kernel/binfmt_elfo32.c | 12 +-
arch/mn10300/include/asm/Kbuild | 1 -
arch/nios2/include/asm/Kbuild | 1 -
arch/openrisc/include/asm/Kbuild | 1 -
arch/parisc/include/asm/Kbuild | 1 -
arch/parisc/kernel/binfmt_elf32.c | 11 +-
arch/parisc/kernel/setup.c | 2 +
arch/powerpc/include/asm/accounting.h | 14 +-
arch/powerpc/include/asm/cputime.h | 177 +--
arch/powerpc/include/asm/paca.h | 1 -
arch/powerpc/kernel/asm-offsets.c | 8 +-
arch/powerpc/kernel/time.c | 161 +-
arch/powerpc/xmon/xmon.c | 8 +-
arch/s390/appldata/appldata_os.c | 16 +-
arch/s390/include/asm/cputime.h | 109 +-
arch/s390/include/asm/lowcore.h | 65 +-
arch/s390/include/asm/processor.h | 3 +
arch/s390/kernel/idle.c | 9 +-
arch/s390/kernel/vtime.c | 142 +-
arch/score/include/asm/Kbuild | 1 -
arch/sh/include/asm/Kbuild | 1 -
arch/sparc/include/asm/Kbuild | 1 -
arch/tile/include/asm/Kbuild | 1 -
arch/um/include/asm/Kbuild | 1 -
arch/unicore32/include/asm/Kbuild | 1 -
arch/x86/include/asm/Kbuild | 1 -
arch/x86/kernel/apm_32.c | 6 +-
arch/x86/kernel/cpu/amd.c | 6 +-
arch/x86/kernel/cpu/centaur.c | 6 +-
arch/x86/kernel/cpu/common.c | 3 +
arch/x86/kernel/cpu/cyrix.c | 2 +
arch/x86/kernel/cpu/intel.c | 6 +-
arch/x86/kernel/cpu/transmeta.c | 3 +
arch/x86/kernel/itmt.c | 6 +-
arch/x86/kernel/kvmclock.c | 2 +-
arch/x86/kernel/tsc.c | 11 +
arch/x86/kvm/hyperv.c | 5 +-
arch/xtensa/include/asm/Kbuild | 1 -
drivers/cpufreq/cpufreq.c | 6 +-
drivers/cpufreq/cpufreq_governor.c | 2 +-
drivers/cpufreq/cpufreq_stats.c | 1 -
drivers/isdn/mISDN/stack.c | 4 +-
drivers/macintosh/rack-meter.c | 28 +-
fs/binfmt_elf.c | 15 +-
fs/binfmt_elf_fdpic.c | 14 +-
fs/compat_binfmt_elf.c | 18 +-
fs/jbd2/commit.c | 2 +-
fs/jbd2/journal.c | 12 +-
fs/proc/array.c | 16 +-
fs/proc/stat.c | 64 +-
fs/proc/uptime.c | 7 +-
include/asm-generic/cputime.h | 15 -
include/asm-generic/cputime_jiffies.h | 75 -
include/asm-generic/cputime_nsecs.h | 121 --
include/linux/clocksource.h | 3 +
include/linux/compat.h | 20 +-
include/linux/cputime.h | 7 +-
include/linux/delayacct.h | 1 +
include/linux/jiffies.h | 2 +
include/linux/kernel_stat.h | 14 +-
include/linux/mutex.h | 4 +
include/linux/posix-timers.h | 14 +-
include/linux/sched.h | 80 +-
include/linux/sched/sysctl.h | 1 +
include/linux/vtime.h | 7 +-
include/trace/events/timer.h | 26 +-
init/main.c | 1 -
kernel/acct.c | 7 +-
kernel/delayacct.c | 6 +-
kernel/exit.c | 4 +-
kernel/fork.c | 2 +-
kernel/locking/mutex.c | 24 +
kernel/sched/Makefile | 4 +-
kernel/sched/{auto_group.c => autogroup.c} | 0
kernel/sched/{auto_group.h => autogroup.h} | 0
kernel/sched/clock.c | 158 +-
kernel/sched/completion.c | 10 +-
kernel/sched/core.c | 2355 +++++-----------------------
kernel/sched/cpuacct.c | 2 +-
kernel/sched/cputime.c | 178 +--
kernel/sched/deadline.c | 13 +-
kernel/sched/debug.c | 4 +
kernel/sched/fair.c | 94 +-
kernel/sched/idle_task.c | 2 +-
kernel/sched/rt.c | 10 +-
kernel/sched/sched.h | 137 +-
kernel/sched/stats.h | 4 +-
kernel/sched/stop_task.c | 2 +-
kernel/sched/topology.c | 1658 ++++++++++++++++++++
kernel/signal.c | 12 +-
kernel/sys.c | 16 +-
kernel/sysctl.c | 2 +-
kernel/time/clocksource.c | 4 +
kernel/time/itimer.c | 60 +-
kernel/time/jiffies.c | 32 +-
kernel/time/posix-cpu-timers.c | 170 +-
kernel/time/time.c | 10 +
kernel/time/timeconst.bc | 6 +
kernel/tsacct.c | 21 +-
124 files changed, 3151 insertions(+), 3381 deletions(-)
delete mode 100644 include/asm-generic/cputime.h
delete mode 100644 include/asm-generic/cputime_jiffies.h
delete mode 100644 include/asm-generic/cputime_nsecs.h
rename kernel/sched/{auto_group.c => autogroup.c} (100%)
rename kernel/sched/{auto_group.h => autogroup.h} (100%)
create mode 100644 kernel/sched/topology.cDocumentation/scheduler/sched-deadline.txt +6 -0
@@ -408,6 +408,11 @@ CONTENTS * the new scheduling related syscalls that manipulate it, i.e., sched_setattr() and sched_getattr() are implemented. + For debugging purposes, the leftover runtime and absolute deadline of a + SCHED_DEADLINE task can be retrieved through /proc/<pid>/sched (entries + dl.runtime and dl.deadline, both values in ns). A programmatic way to + retrieve these values from production code is under discussion. + 4.3 Default behavior ---------------------
@@ -476,6 +481,7 @@ CONTENTS Still missing: + - programmatic way to retrieve current runtime and absolute deadline - refinements to deadline inheritance, especially regarding the possibility of retaining bandwidth isolation among non-interacting tasks. This is being studied from both theoretical and practical points of view, and
Documentation/scheduler/sched-rt-group.txt +4 -4
@@ -158,11 +158,11 @@ as its prone to starvation without deadline scheduling. Consider two sibling groups A and B; both have 50% bandwidth, but A's period is twice the length of B's. -* group A: period=100000us, runtime=10000us - - this runs for 0.01s once every 0.1s +* group A: period=100000us, runtime=50000us + - this runs for 0.05s once every 0.1s -* group B: period= 50000us, runtime=10000us - - this runs for 0.01s twice every 0.1s (or once every 0.05 sec). +* group B: period= 50000us, runtime=25000us + - this runs for 0.025s twice every 0.1s (or once every 0.05 sec). This means that currently a while (1) loop in A will run for the full period of B and can starve B's tasks (assuming they are of lower priority) for a whole
arch/alpha/include/asm/Kbuild +0 -1
@@ -1,7 +1,6 @@ generic-y += clkdev.h -generic-y += cputime.h generic-y += exec.h generic-y += export.h generic-y += irq_work.h
arch/alpha/kernel/osf_sys.c +5 -5
@@ -1145,7 +1145,7 @@ struct rusage32 { SYSCALL_DEFINE2(osf_getrusage, int, who, struct rusage32 __user *, ru) {struct rusage32 r; -cputime_t utime, stime; +u64 utime, stime;unsigned long utime_jiffies, stime_jiffies;if (who !=RUSAGE_SELF && who !=RUSAGE_CHILDREN )
@@ -1155,16 +1155,16 @@ SYSCALL_DEFINE2(osf_getrusage, int, who, struct rusage32 __user *, ru)switch (who) {case RUSAGE_SELF :task_cputime (current, &utime, &stime); - utime_jiffies =cputime_to_jiffies (utime); - stime_jiffies =cputime_to_jiffies (stime); + utime_jiffies =nsecs_to_jiffies (utime); + stime_jiffies =nsecs_to_jiffies (stime);jiffies_to_timeval32 (utime_jiffies, &r.ru_utime);jiffies_to_timeval32 (stime_jiffies, &r.ru_stime); r.ru_minflt = current->min_flt; r.ru_majflt = current->maj_flt;break ;case RUSAGE_CHILDREN : - utime_jiffies =cputime_to_jiffies (current->signal->cutime); - stime_jiffies =cputime_to_jiffies (current->signal->cstime); + utime_jiffies =nsecs_to_jiffies (current->signal->cutime); + stime_jiffies =nsecs_to_jiffies (current->signal->cstime);jiffies_to_timeval32 (utime_jiffies, &r.ru_utime);jiffies_to_timeval32 (stime_jiffies, &r.ru_stime); r.ru_minflt = current->signal->cmin_flt;
arch/arc/include/asm/Kbuild +0 -1
@@ -2,7 +2,6 @@ generic-y += auxvec.h generic-y += bitsperlong.h generic-y += bugs.h generic-y += clkdev.h -generic-y += cputime.h generic-y += device.h generic-y += div64.h generic-y += emergency-restart.h
arch/arm/include/asm/Kbuild +0 -1
@@ -2,7 +2,6 @@ generic-y += bitsperlong.h generic-y += clkdev.h -generic-y += cputime.h generic-y += current.h generic-y += early_ioremap.h generic-y += emergency-restart.h
arch/arm64/include/asm/Kbuild +0 -1
@@ -1,6 +1,5 @@ generic-y += bugs.h generic-y += clkdev.h -generic-y += cputime.h generic-y += delay.h generic-y += div64.h generic-y += dma.h
arch/avr32/include/asm/Kbuild +0 -1
@@ -1,6 +1,5 @@ generic-y += clkdev.h -generic-y += cputime.h generic-y += delay.h generic-y += device.h generic-y += div64.h
arch/blackfin/include/asm/Kbuild +0 -1
@@ -2,7 +2,6 @@ generic-y += auxvec.h generic-y += bitsperlong.h generic-y += bugs.h -generic-y += cputime.h generic-y += current.h generic-y += device.h generic-y += div64.h
arch/c6x/include/asm/Kbuild +0 -1
@@ -5,7 +5,6 @@ generic-y += barrier.h generic-y += bitsperlong.h generic-y += bugs.h generic-y += clkdev.h -generic-y += cputime.h generic-y += current.h generic-y += device.h generic-y += div64.h
arch/cris/include/asm/Kbuild +0 -1
@@ -4,7 +4,6 @@ generic-y += barrier.h generic-y += bitsperlong.h generic-y += clkdev.h generic-y += cmpxchg.h -generic-y += cputime.h generic-y += device.h generic-y += div64.h generic-y += errno.h
arch/frv/include/asm/Kbuild +0 -1
@@ -1,6 +1,5 @@ generic-y += clkdev.h -generic-y += cputime.h generic-y += exec.h generic-y += irq_work.h generic-y += mcs_spinlock.h
arch/h8300/include/asm/Kbuild +0 -1
@@ -5,7 +5,6 @@ generic-y += bugs.h generic-y += cacheflush.h generic-y += checksum.h generic-y += clkdev.h -generic-y += cputime.h generic-y += current.h generic-y += delay.h generic-y += device.h
arch/hexagon/include/asm/Kbuild +0 -1
@@ -6,7 +6,6 @@ generic-y += barrier.h generic-y += bug.h generic-y += bugs.h generic-y += clkdev.h -generic-y += cputime.h generic-y += current.h generic-y += device.h generic-y += div64.h
arch/ia64/include/asm/cputime.h +1 -5
@@ -18,11 +18,7 @@#ifndef __IA64_CPUTIME_H#define __IA64_CPUTIME_H -#ifndef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE -# include <asm-generic/cputime.h> -#else -# include <asm/processor.h> -# include <asm-generic/cputime_nsecs.h> +#ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE extern void arch_vtime_task_switch (struct task_struct *tsk);#endif /* CONFIG_VIRT_CPU_ACCOUNTING_NATIVE */
arch/ia64/include/asm/thread_info.h +6 -0
@@ -27,6 +27,12 @@ struct thread_info {mm_segment_t addr_limit;/* user-level address space limit */ int preempt_count;/* 0=premptable, <0=BUG; will also serve as bh-counter */ #ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE +__u64 utime; +__u64 stime; +__u64 gtime; +__u64 hardirq_time; +__u64 softirq_time; +__u64 idle_time;__u64 ac_stamp;__u64 ac_leave;__u64 ac_stime;
arch/ia64/kernel/head.S +2 -2
@@ -1031,7 +1031,7 @@ GLOBAL_ENTRY(ia64_native_sched_clock) END(ia64_native_sched_clock) #ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE -GLOBAL_ENTRY(cycle_to_cputime) +GLOBAL_ENTRY(cycle_to_nsec) alloc r16=ar.pfs,1,0,0,0 addl r8=THIS_CPU(ia64_cpu_info) + IA64_CPUINFO_NSEC_PER_CYC_OFFSET,r0 ;;
@@ -1047,7 +1047,7 @@ GLOBAL_ENTRY(cycle_to_cputime) ;; shrp r8=r9,r8,IA64_NSEC_PER_CYC_SHIFT br.ret.sptk.many rp -END(cycle_to_cputime) +END(cycle_to_nsec) #endif /* CONFIG_VIRT_CPU_ACCOUNTING_NATIVE */ #ifdef CONFIG_IA64_BRL_EMU
arch/ia64/kernel/setup.c +2 -0
@@ -619,6 +619,8 @@ setup_arch (char **cmdline_p)check_sal_cache_flush ();#endif paging_init (); + +clear_sched_clock_stable (); }/*
arch/ia64/kernel/time.c +51 -18
115 lines not on this page · raw message
arch/m32r/include/asm/Kbuild +0 -1
@@ -1,6 +1,5 @@ generic-y += clkdev.h -generic-y += cputime.h generic-y += exec.h generic-y += irq_work.h generic-y += kvm_para.h
arch/m68k/include/asm/Kbuild +0 -1
@@ -1,7 +1,6 @@ generic-y += barrier.h generic-y += bitsperlong.h generic-y += clkdev.h -generic-y += cputime.h generic-y += device.h generic-y += emergency-restart.h generic-y += errno.h
arch/metag/include/asm/Kbuild +0 -1
@@ -2,7 +2,6 @@ generic-y += auxvec.h generic-y += bitsperlong.h generic-y += bugs.h generic-y += clkdev.h -generic-y += cputime.h generic-y += current.h generic-y += device.h generic-y += dma.h
arch/microblaze/include/asm/Kbuild +0 -1
@@ -1,7 +1,6 @@ generic-y += barrier.h generic-y += clkdev.h -generic-y += cputime.h generic-y += device.h generic-y += exec.h generic-y += irq_work.h
arch/mips/include/asm/Kbuild +0 -1
@@ -1,7 +1,6 @@ # MIPS headers generic-(CONFIG_GENERIC_CSUM) += checksum.h generic-y += clkdev.h -generic-y += cputime.h generic-y += current.h generic-y += dma-contiguous.h generic-y += emergency-restart.h
arch/mips/kernel/binfmt_elfn32.c +2 -10
@@ -99,15 +99,7 @@ jiffies_to_compat_timeval(unsigned long jiffies, struct compat_timeval *value)#undef TASK_SIZE#define TASK_SIZE TASK_SIZE32 -#undef cputime_to_timeval -#define cputime_to_timeval cputime_to_compat_timeval -static __inline__void -cputime_to_compat_timeval (const cputime_t cputime,struct compat_timeval *value) -{ -unsigned long jiffies =cputime_to_jiffies (cputime); - - value->tv_usec = (jiffies %HZ ) * (1000000L /HZ ); - value->tv_sec = jiffies /HZ ; -} +#undef ns_to_timeval +#define ns_to_timeval ns_to_compat_timeval#include "../../../fs/binfmt_elf.c"
arch/mips/kernel/binfmt_elfo32.c +2 -10
@@ -102,15 +102,7 @@ jiffies_to_compat_timeval(unsigned long jiffies, struct compat_timeval *value)#undef TASK_SIZE#define TASK_SIZE TASK_SIZE32 -#undef cputime_to_timeval -#define cputime_to_timeval cputime_to_compat_timeval -static __inline__void -cputime_to_compat_timeval (const cputime_t cputime,struct compat_timeval *value) -{ -unsigned long jiffies =cputime_to_jiffies (cputime); - - value->tv_usec = (jiffies %HZ ) * (1000000L /HZ ); - value->tv_sec = jiffies /HZ ; -} +#undef ns_to_timeval +#define ns_to_timeval ns_to_compat_timeval#include "../../../fs/binfmt_elf.c"
arch/mn10300/include/asm/Kbuild +0 -1
@@ -1,7 +1,6 @@ generic-y += barrier.h generic-y += clkdev.h -generic-y += cputime.h generic-y += exec.h generic-y += irq_work.h generic-y += mcs_spinlock.h
arch/nios2/include/asm/Kbuild +0 -1
@@ -6,7 +6,6 @@ generic-y += bitsperlong.h generic-y += bug.h generic-y += bugs.h generic-y += clkdev.h -generic-y += cputime.h generic-y += current.h generic-y += device.h generic-y += div64.h
arch/openrisc/include/asm/Kbuild +0 -1
@@ -12,7 +12,6 @@ generic-y += checksum.h generic-y += clkdev.h generic-y += cmpxchg-local.h generic-y += cmpxchg.h -generic-y += cputime.h generic-y += current.h generic-y += device.h generic-y += div64.h
arch/parisc/include/asm/Kbuild +0 -1
@@ -2,7 +2,6 @@ generic-y += auxvec.h generic-y += barrier.h generic-y += clkdev.h -generic-y += cputime.h generic-y += device.h generic-y += div64.h generic-y += emergency-restart.h
arch/parisc/kernel/binfmt_elf32.c +2 -9
@@ -91,14 +91,7 @@ struct elf_prpsinfo32 current->thread.map_base =DEFAULT_MAP_BASE32 ; \ current->thread.task_size = DEFAULT_TASK_SIZE32 \ -#undef cputime_to_timeval -#define cputime_to_timeval cputime_to_compat_timeval -static __inline__void -cputime_to_compat_timeval (const cputime_t cputime,struct compat_timeval *value) -{ -unsigned long jiffies =cputime_to_jiffies (cputime); - value->tv_usec = (jiffies %HZ ) * (1000000L /HZ ); - value->tv_sec = jiffies /HZ ; -} +#undef ns_to_timeval +#define ns_to_timeval ns_to_compat_timeval#include "../../../fs/binfmt_elf.c"
arch/parisc/kernel/setup.c +2 -0
@@ -36,6 +36,7 @@#undef PCI_DEBUG#include <linux/proc_fs.h> #include <linux/export.h> +#include <linux/sched.h> #include <asm/processor.h> #include <asm/sections.h>
@@ -176,6 +177,7 @@ void __init setup_arch(char **cmdline_p) conswitchp = &dummy_con;/* we use do_take_over_console() later ! */ #endif +clear_sched_clock_stable (); }/*
arch/powerpc/include/asm/accounting.h +11 -3
@@ -12,9 +12,17 @@/* Stuff for accurate time accounting */ struct cpu_accounting_data { -unsigned long user_time;/* accumulated usermode TB ticks */ -unsigned long system_time;/* accumulated system TB ticks */ -unsigned long user_time_scaled;/* accumulated usermode SPURR ticks */ +/* Accumulated cputime values to flush on ticks*/ +unsigned long utime; +unsigned long stime; +unsigned long utime_scaled; +unsigned long stime_scaled; +unsigned long gtime; +unsigned long hardirq_time; +unsigned long softirq_time; +unsigned long steal_time; +unsigned long idle_time; +/* Internal counters */ unsigned long starttime;/* TB value snapshot */ unsigned long starttime_user;/* TB value on exit to usermode */ unsigned long startspurr;/* SPURR value snapshot */
arch/powerpc/include/asm/cputime.h +1 -176
195 lines not on this page · raw message
arch/powerpc/include/asm/paca.h +0 -1
@@ -187,7 +187,6 @@ struct paca_struct {/* Stuff for accurate time accounting */ struct cpu_accounting_data accounting; -u64 stolen_time;/* TB ticks taken by hypervisor */ u64 dtl_ridx;/* read index in dispatch log */ struct dtl_entry *dtl_curr;/* pointer corresponding to dtl_ridx */
arch/powerpc/kernel/asm-offsets.c +4 -4
@@ -252,9 +252,9 @@ int main(void)DEFINE (ACCOUNT_STARTTIME_USER , offsetof(struct paca_struct, accounting.starttime_user));DEFINE (ACCOUNT_USER_TIME , - offsetof(struct paca_struct, accounting.user_time)); + offsetof(struct paca_struct, accounting.utime));DEFINE (ACCOUNT_SYSTEM_TIME , - offsetof(struct paca_struct, accounting.system_time)); + offsetof(struct paca_struct, accounting.stime));DEFINE (PACA_TRAP_SAVE , offsetof(struct paca_struct , trap_save));DEFINE (PACA_NAPSTATELOST , offsetof(struct paca_struct , nap_state_lost));DEFINE (PACA_SPRG_VDSO , offsetof(struct paca_struct , sprg_vdso));
@@ -265,9 +265,9 @@ int main(void)DEFINE (ACCOUNT_STARTTIME_USER , offsetof(struct thread_info, accounting.starttime_user));DEFINE (ACCOUNT_USER_TIME , - offsetof(struct thread_info, accounting.user_time)); + offsetof(struct thread_info, accounting.utime));DEFINE (ACCOUNT_SYSTEM_TIME , - offsetof(struct thread_info, accounting.system_time)); + offsetof(struct thread_info, accounting.stime));#endif #endif /* CONFIG_PPC64 */
arch/powerpc/kernel/time.c +90 -71
267 lines not on this page · raw message
arch/powerpc/xmon/xmon.c +4 -4
@@ -2287,14 +2287,14 @@ static void dump_one_paca(int cpu)DUMP (p, subcore_sibling_mask,"x" );#endif -DUMP (p, accounting.user_time,"llx" ); -DUMP (p, accounting.system_time,"llx" ); -DUMP (p, accounting.user_time_scaled,"llx" ); +DUMP (p, accounting.utime,"llx" ); +DUMP (p, accounting.stime,"llx" ); +DUMP (p, accounting.utime_scaled,"llx" );DUMP (p, accounting.starttime,"llx" );DUMP (p, accounting.starttime_user,"llx" );DUMP (p, accounting.startspurr,"llx" );DUMP (p, accounting.utime_sspurr,"llx" ); -DUMP (p, stolen_time,"llx" ); +DUMP (p, accounting.steal_time,"llx" );#undef DUMP catch_memory_errors =0 ;
arch/s390/appldata/appldata_os.c +8 -8
@@ -113,21 +113,21 @@ static void appldata_get_os_data(void *data) j =0 ;for_each_online_cpu (i) { os_data->os_cpu[j].per_cpu_user = -cputime_to_jiffies (kcpustat_cpu (i).cpustat[CPUTIME_USER ]); +nsecs_to_jiffies (kcpustat_cpu (i).cpustat[CPUTIME_USER ]); os_data->os_cpu[j].per_cpu_nice = -cputime_to_jiffies (kcpustat_cpu (i).cpustat[CPUTIME_NICE ]); +nsecs_to_jiffies (kcpustat_cpu (i).cpustat[CPUTIME_NICE ]); os_data->os_cpu[j].per_cpu_system = -cputime_to_jiffies (kcpustat_cpu (i).cpustat[CPUTIME_SYSTEM ]); +nsecs_to_jiffies (kcpustat_cpu (i).cpustat[CPUTIME_SYSTEM ]); os_data->os_cpu[j].per_cpu_idle = -cputime_to_jiffies (kcpustat_cpu (i).cpustat[CPUTIME_IDLE ]); +nsecs_to_jiffies (kcpustat_cpu (i).cpustat[CPUTIME_IDLE ]); os_data->os_cpu[j].per_cpu_irq = -cputime_to_jiffies (kcpustat_cpu (i).cpustat[CPUTIME_IRQ ]); +nsecs_to_jiffies (kcpustat_cpu (i).cpustat[CPUTIME_IRQ ]); os_data->os_cpu[j].per_cpu_softirq = -cputime_to_jiffies (kcpustat_cpu (i).cpustat[CPUTIME_SOFTIRQ ]); +nsecs_to_jiffies (kcpustat_cpu (i).cpustat[CPUTIME_SOFTIRQ ]); os_data->os_cpu[j].per_cpu_iowait = -cputime_to_jiffies (kcpustat_cpu (i).cpustat[CPUTIME_IOWAIT ]); +nsecs_to_jiffies (kcpustat_cpu (i).cpustat[CPUTIME_IOWAIT ]); os_data->os_cpu[j].per_cpu_steal = -cputime_to_jiffies (kcpustat_cpu (i).cpustat[CPUTIME_STEAL ]); +nsecs_to_jiffies (kcpustat_cpu (i).cpustat[CPUTIME_STEAL ]); os_data->os_cpu[j].cpu_id = i; j++; }
arch/s390/include/asm/cputime.h +1 -108
122 lines not on this page · raw message
arch/s390/include/asm/lowcore.h +34 -31
87 lines not on this page · raw message
arch/s390/include/asm/processor.h +3 -0
@@ -111,7 +111,10 @@ struct thread_struct {unsigned int acrs[NUM_ACRS ];unsigned long ksp;/* kernel stack pointer */ unsigned long user_timer;/* task cputime in user space */ +unsigned long guest_timer;/* task cputime in kvm guest */ unsigned long system_timer;/* task cputime in kernel space */ +unsigned long hardirq_timer;/* task cputime in hardirq context */ +unsigned long softirq_timer;/* task cputime in softirq context */ unsigned long sys_call_table;/* system call table address */ mm_segment_t mm_segment;unsigned long gmap_addr;/* address of last gmap fault. */
arch/s390/kernel/idle.c +5 -4
@@ -12,7 +12,7 @@#include <linux/notifier.h> #include <linux/init.h> #include <linux/cpu.h> -#include <asm/cputime.h> +#include <linux/cputime.h> #include <asm/nmi.h> #include <asm/smp.h> #include "entry.h"
@@ -43,7 +43,7 @@ void enabled_wait(void) idle->clock_idle_enter = idle->clock_idle_exit =0ULL ; idle->idle_time += idle_time; idle->idle_count++; -account_idle_time (idle_time); +account_idle_time (cputime_to_nsecs (idle_time));write_seqcount_end (&idle->seqcount); }NOKPROBE_SYMBOL (enabled_wait);
@@ -84,7 +84,7 @@ static ssize_t show_idle_time(struct device *dev, }DEVICE_ATTR (idle_time_us,0444 , show_idle_time,NULL ); -cputime64_t arch_cpu_idle_time (int cpu) +u64 arch_cpu_idle_time (int cpu) {struct s390_idle_data *idle = &per_cpu (s390_idle, cpu);unsigned long long now, idle_enter, idle_exit;
@@ -96,7 +96,8 @@ cputime64_t arch_cpu_idle_time(int cpu) idle_enter =ACCESS_ONCE (idle->clock_idle_enter); idle_exit =ACCESS_ONCE (idle->clock_idle_exit); }while (read_seqcount_retry (&idle->seqcount, seq)); -return idle_enter ? ((idle_exit ?: now) - idle_enter) :0 ; + +return cputime_to_nsecs (idle_enter ? ((idle_exit ?: now) - idle_enter) :0 ); }void arch_cpu_idle_enter (void )
arch/s390/kernel/vtime.c +91 -51
210 lines not on this page · raw message
arch/score/include/asm/Kbuild +0 -1
@@ -4,7 +4,6 @@ header-y += generic-y += barrier.h generic-y += clkdev.h -generic-y += cputime.h generic-y += irq_work.h generic-y += mcs_spinlock.h generic-y += mm-arch-hooks.h
arch/sh/include/asm/Kbuild +0 -1
@@ -1,7 +1,6 @@ generic-y += bitsperlong.h generic-y += clkdev.h -generic-y += cputime.h generic-y += current.h generic-y += delay.h generic-y += div64.h
arch/sparc/include/asm/Kbuild +0 -1
@@ -2,7 +2,6 @@ generic-y += clkdev.h -generic-y += cputime.h generic-y += div64.h generic-y += emergency-restart.h generic-y += exec.h
arch/tile/include/asm/Kbuild +0 -1
@@ -4,7 +4,6 @@ header-y += ../arch/ generic-y += bug.h generic-y += bugs.h generic-y += clkdev.h -generic-y += cputime.h generic-y += div64.h generic-y += emergency-restart.h generic-y += errno.h
arch/um/include/asm/Kbuild +0 -1
@@ -1,7 +1,6 @@ generic-y += barrier.h generic-y += bug.h generic-y += clkdev.h -generic-y += cputime.h generic-y += current.h generic-y += delay.h generic-y += device.h
arch/unicore32/include/asm/Kbuild +0 -1
@@ -4,7 +4,6 @@ generic-y += auxvec.h generic-y += bitsperlong.h generic-y += bugs.h generic-y += clkdev.h -generic-y += cputime.h generic-y += current.h generic-y += device.h generic-y += div64.h
arch/x86/include/asm/Kbuild +0 -1
@@ -7,7 +7,6 @@ generated-y += unistd_64_x32.h generated-y += xen-hypercalls.h generic-y += clkdev.h -generic-y += cputime.h generic-y += dma-contiguous.h generic-y += early_ioremap.h generic-y += mcs_spinlock.h
arch/x86/kernel/apm_32.c +3 -3
@@ -905,8 +905,8 @@ static int apm_cpu_idle(struct cpuidle_device *dev, {static int use_apm_idle;/* = 0 */ static unsigned int last_jiffies;/* = 0 */ -static unsigned int last_stime;/* = 0 */ -cputime_t stime, utime; +static u64 last_stime;/* = 0 */ +u64 stime, utime;int apm_idle_done =0 ;unsigned int jiffies_since_last_check = jiffies - last_jiffies;
@@ -919,7 +919,7 @@ static int apm_cpu_idle(struct cpuidle_device *dev, }else if (jiffies_since_last_check > idle_period) {unsigned int idle_percentage; - idle_percentage =cputime_to_jiffies (stime - last_stime); + idle_percentage =nsecs_to_jiffies (stime - last_stime); idle_percentage *=100 ; idle_percentage /= jiffies_since_last_check; use_apm_idle = (idle_percentage > idle_threshold);
arch/x86/kernel/cpu/amd.c +4 -2
@@ -541,8 +541,10 @@ static void early_init_amd(struct cpuinfo_x86 *c)if (c->x86_power & (1 <<8 )) {set_cpu_cap (c,X86_FEATURE_CONSTANT_TSC );set_cpu_cap (c,X86_FEATURE_NONSTOP_TSC ); -if (!check_tsc_unstable ()) -set_sched_clock_stable (); +if (check_tsc_unstable ()) +clear_sched_clock_stable (); + }else { +clear_sched_clock_stable (); }/* Bit 12 of 8000_0007 edx is accumulated power mechanism. */
arch/x86/kernel/cpu/centaur.c +4 -2
@@ -1,5 +1,5 @@ -#include <linux/bitops.h> -#include <linux/kernel.h> + +#include <linux/sched.h> #include <asm/cpufeature.h> #include <asm/e820.h>
@@ -104,6 +104,8 @@ static void early_init_centaur(struct cpuinfo_x86 *c)#ifdef CONFIG_X86_64 set_cpu_cap (c,X86_FEATURE_SYSENTER32 );#endif + +clear_sched_clock_stable (); }static void init_centaur (struct cpuinfo_x86 *c)
arch/x86/kernel/cpu/common.c +3 -0
@@ -83,6 +83,7 @@ static void default_init(struct cpuinfo_x86 *c)strcpy (c->x86_model_id,"386" ); }#endif +clear_sched_clock_stable (); } static const struct cpu_dev default_cpu = {
@@ -1055,6 +1056,8 @@ static void identify_cpu(struct cpuinfo_x86 *c)*/ if (this_cpu->c_init) this_cpu->c_init (c); +else +clear_sched_clock_stable ();/* Disable the PN if appropriate */ squash_the_stupid_serial_number (c);
arch/x86/kernel/cpu/cyrix.c +2 -0
@@ -9,6 +9,7 @@#include <asm/pci-direct.h> #include <asm/tsc.h> #include <asm/cpufeature.h> +#include <linux/sched.h> #include "cpu.h"
@@ -183,6 +184,7 @@ static void early_init_cyrix(struct cpuinfo_x86 *c)set_cpu_cap (c,X86_FEATURE_CYRIX_ARR );break ; } +clear_sched_clock_stable (); }static void init_cyrix (struct cpuinfo_x86 *c)
arch/x86/kernel/cpu/intel.c +4 -2
@@ -119,8 +119,10 @@ static void early_init_intel(struct cpuinfo_x86 *c)if (c->x86_power & (1 <<8 )) {set_cpu_cap (c,X86_FEATURE_CONSTANT_TSC );set_cpu_cap (c,X86_FEATURE_NONSTOP_TSC ); -if (!check_tsc_unstable ()) -set_sched_clock_stable (); +if (check_tsc_unstable ()) +clear_sched_clock_stable (); + }else { +clear_sched_clock_stable (); }/* Penwell and Cloverview have the TSC which doesn't sleep on S3 */
arch/x86/kernel/cpu/transmeta.c +3 -0
@@ -1,4 +1,5 @@#include <linux/kernel.h> +#include <linux/sched.h> #include <linux/mm.h> #include <asm/cpufeature.h> #include <asm/msr.h>
@@ -14,6 +15,8 @@ static void early_init_transmeta(struct cpuinfo_x86 *c)if (xlvl >=0x80860001 ) c->x86_capability[CPUID_8086_0001_EDX ] =cpuid_edx (0x80860001 ); } + +clear_sched_clock_stable (); }static void init_transmeta (struct cpuinfo_x86 *c)
arch/x86/kernel/itmt.c +2 -4
@@ -132,10 +132,8 @@ int sched_set_itmt_support(void) sysctl_sched_itmt_enabled =1 ; -if (sysctl_sched_itmt_enabled) { - x86_topology_update = true; -rebuild_sched_domains (); - } + x86_topology_update = true; +rebuild_sched_domains ();mutex_unlock (&itmt_update_mutex);
arch/x86/kernel/kvmclock.c +1 -1
@@ -107,12 +107,12 @@ static inline void kvm_sched_clock_init(bool stable) {if (!stable) { pv_time_ops.sched_clock = kvm_clock_read; +clear_sched_clock_stable ();return ; } kvm_sched_clock_offset =kvm_clock_read (); pv_time_ops.sched_clock = kvm_sched_clock_read; -set_sched_clock_stable ();printk (KERN_INFO "kvm-clock: using sched offset of %llu cycles\n" , kvm_sched_clock_offset);
arch/x86/kernel/tsc.c +11 -0
@@ -1107,6 +1107,16 @@ static u64 read_tsc(struct clocksource *cs)return (u64 )rdtsc_ordered (); } +static void tsc_cs_mark_unstable (struct clocksource *cs) +{ +if (tsc_unstable) +return ; + tsc_unstable =1 ; +clear_sched_clock_stable (); +disable_sched_clock_irqtime (); +pr_info ("Marking TSC unstable due to clocksource watchdog\n" ); +} +/* * .mask MUST be CLOCKSOURCE_MASK(64). See comment above read_tsc() */
@@ -1119,6 +1129,7 @@ static struct clocksource clocksource_tsc = { CLOCK_SOURCE_MUST_VERIFY, .archdata = { .vclock_mode = VCLOCK_TSC }, .resume = tsc_resume, + .mark_unstable = tsc_cs_mark_unstable, };void mark_tsc_unstable (char *reason)
arch/x86/kvm/hyperv.c +3 -2
@@ -964,10 +964,11 @@ static int kvm_hv_set_msr_pw(struct kvm_vcpu *vcpu, u32 msr, u64 data,/* Calculate cpu time spent by current task in 100ns units */ static u64 current_task_runtime_100ns (void ) { -cputime_t utime, stime; +u64 utime, stime;task_cputime_adjusted (current, &utime, &stime); -return div_u64 (cputime_to_nsecs (utime + stime),100 ); + +return div_u64 (utime + stime,100 ); }static int kvm_hv_set_msr (struct kvm_vcpu *vcpu,u32 msr,u64 data,bool host)
arch/xtensa/include/asm/Kbuild +0 -1
@@ -1,7 +1,6 @@ generic-y += bitsperlong.h generic-y += bug.h generic-y += clkdev.h -generic-y += cputime.h generic-y += div64.h generic-y += dma-contiguous.h generic-y += emergency-restart.h
drivers/cpufreq/cpufreq.c +3 -3
@@ -132,7 +132,7 @@ static inline u64 get_cpu_idle_time_jiffy(unsigned int cpu, u64 *wall)u64 cur_wall_time;u64 busy_time; - cur_wall_time =jiffies64_to_cputime64 (get_jiffies_64 ()); + cur_wall_time =jiffies64_to_nsecs (get_jiffies_64 ()); busy_time =kcpustat_cpu (cpu).cpustat[CPUTIME_USER ]; busy_time +=kcpustat_cpu (cpu).cpustat[CPUTIME_SYSTEM ];
@@ -143,9 +143,9 @@ static inline u64 get_cpu_idle_time_jiffy(unsigned int cpu, u64 *wall) idle_time = cur_wall_time - busy_time;if (wall) - *wall =cputime_to_usecs (cur_wall_time); + *wall =div_u64 (cur_wall_time,NSEC_PER_USEC ); -return cputime_to_usecs (idle_time); +return div_u64 (idle_time,NSEC_PER_USEC ); }u64 get_cpu_idle_time (unsigned int cpu,u64 *wall,int io_busy)
drivers/cpufreq/cpufreq_governor.c +1 -1
@@ -152,7 +152,7 @@ unsigned int dbs_update(struct cpufreq_policy *policy)if (ignore_nice) {u64 cur_nice =kcpustat_cpu (j).cpustat[CPUTIME_NICE ]; - idle_time +=cputime_to_usecs (cur_nice - j_cdbs->prev_cpu_nice); + idle_time +=div_u64 (cur_nice - j_cdbs->prev_cpu_nice,NSEC_PER_USEC ); j_cdbs->prev_cpu_nice = cur_nice; }
drivers/cpufreq/cpufreq_stats.c +0 -1
@@ -13,7 +13,6 @@#include <linux/cpufreq.h> #include <linux/module.h> #include <linux/slab.h> -#include <linux/cputime.h> static DEFINE_SPINLOCK (cpufreq_stats_lock);
drivers/isdn/mISDN/stack.c +2 -2
@@ -203,7 +203,7 @@ mISDNStackd(void *data) {struct mISDNstack *st = data;#ifdef MISDN_MSG_STATS -cputime_t utime, stime; +u64 utime, stime;#endif int err =0 ;
@@ -308,7 +308,7 @@ mISDNStackd(void *data) st->stopped_cnt);task_cputime (st->thread, &utime, &stime);printk (KERN_DEBUG -"mISDNStackd daemon for %s utime(%ld) stime(%ld)\n" , +"mISDNStackd daemon for %s utime(%llu) stime(%llu)\n" ,dev_name (&st->dev->dev), utime, stime); printk(KERN_DEBUG "mISDNStackd daemon for %s nvcsw(%ld) nivcsw(%ld)\n",
drivers/macintosh/rack-meter.c +14 -14
@@ -52,8 +52,8 @@ struct rackmeter_dma {struct rackmeter_cpu {struct delayed_work sniffer;struct rackmeter *rm; -cputime64_t prev_wall; -cputime64_t prev_idle; +u64 prev_wall; +u64 prev_idle;int zero; }____cacheline_aligned ;
@@ -81,7 +81,7 @@ static int rackmeter_ignore_nice;/* This is copied from cpufreq_ondemand, maybe we should put it in * a common header somewhere */ -static inline cputime64_t get_cpu_idle_time (unsigned int cpu) +static inline u64 get_cpu_idle_time (unsigned int cpu) {u64 retval;
@@ -217,23 +217,23 @@ static void rackmeter_do_timer(struct work_struct *work) container_of(work, struct rackmeter_cpu, sniffer.work);struct rackmeter *rm = rcpu->rm;unsigned int cpu =smp_processor_id (); -cputime64_t cur_jiffies, total_idle_ticks; -unsigned int total_ticks, idle_ticks; +u64 cur_nsecs, total_idle_nsecs; +u64 total_nsecs, idle_nsecs;int i, offset, load, cumm, pause; - cur_jiffies =jiffies64_to_cputime64 (get_jiffies_64 ()); - total_ticks = (unsigned int ) (cur_jiffies - rcpu->prev_wall); - rcpu->prev_wall = cur_jiffies; + cur_nsecs =jiffies64_to_nsecs (get_jiffies_64 ()); + total_nsecs = cur_nsecs - rcpu->prev_wall; + rcpu->prev_wall = cur_nsecs; - total_idle_ticks =get_cpu_idle_time (cpu); - idle_ticks = (unsigned int ) (total_idle_ticks - rcpu->prev_idle); - idle_ticks =min (idle_ticks, total_ticks); - rcpu->prev_idle = total_idle_ticks; + total_idle_nsecs =get_cpu_idle_time (cpu); + idle_nsecs = total_idle_nsecs - rcpu->prev_idle; + idle_nsecs =min (idle_nsecs, total_nsecs); + rcpu->prev_idle = total_idle_nsecs;/* We do a very dumb calculation to update the LEDs for now, * we'll do better once we have actual PWM implemented */ - load = (9 * (total_ticks - idle_ticks)) / total_ticks; + load =div64_u64 (9 * (total_nsecs - idle_nsecs), total_nsecs); offset = cpu <<3 ; cumm =0 ;
@@ -278,7 +278,7 @@ static void rackmeter_init_cpu_sniffer(struct rackmeter *rm)continue ; rcpu = &rm->cpu[cpu]; rcpu->prev_idle =get_cpu_idle_time (cpu); - rcpu->prev_wall =jiffies64_to_cputime64 (get_jiffies_64 ()); + rcpu->prev_wall =jiffies64_to_nsecs (get_jiffies_64 ());schedule_delayed_work_on (cpu, &rm->cpu[cpu].sniffer,msecs_to_jiffies (CPU_SAMPLING_RATE )); }
fs/binfmt_elf.c +8 -7
@@ -1428,17 +1428,18 @@ static void fill_prstatus(struct elf_prstatus *prstatus,* group-wide total, not its individual thread total. */ thread_group_cputime (p, &cputime); -cputime_to_timeval (cputime.utime, &prstatus->pr_utime); -cputime_to_timeval (cputime.stime, &prstatus->pr_stime); + prstatus->pr_utime =ns_to_timeval (cputime.utime); + prstatus->pr_stime =ns_to_timeval (cputime.stime); }else { -cputime_t utime, stime; +u64 utime, stime;task_cputime (p, &utime, &stime); -cputime_to_timeval (utime, &prstatus->pr_utime); -cputime_to_timeval (stime, &prstatus->pr_stime); + prstatus->pr_utime =ns_to_timeval (utime); + prstatus->pr_stime =ns_to_timeval (stime); } -cputime_to_timeval (p->signal->cutime, &prstatus->pr_cutime); -cputime_to_timeval (p->signal->cstime, &prstatus->pr_cstime); + + prstatus->pr_cutime =ns_to_timeval (p->signal->cutime); + prstatus->pr_cstime =ns_to_timeval (p->signal->cstime); } static int fill_psinfo(struct elf_prpsinfo *psinfo, struct task_struct *p,
fs/binfmt_elf_fdpic.c +7 -7
@@ -1349,17 +1349,17 @@ static void fill_prstatus(struct elf_prstatus *prstatus,* group-wide total, not its individual thread total. */ thread_group_cputime (p, &cputime); -cputime_to_timeval (cputime.utime, &prstatus->pr_utime); -cputime_to_timeval (cputime.stime, &prstatus->pr_stime); + prstatus->pr_utime =ns_to_timeval (cputime.utime); + prstatus->pr_stime =ns_to_timeval (cputime.stime); }else { -cputime_t utime, stime; +u64 utime, stime;task_cputime (p, &utime, &stime); -cputime_to_timeval (utime, &prstatus->pr_utime); -cputime_to_timeval (stime, &prstatus->pr_stime); + prstatus->pr_utime =ns_to_timeval (utime); + prstatus->pr_stime =ns_to_timeval (stime); } -cputime_to_timeval (p->signal->cutime, &prstatus->pr_cutime); -cputime_to_timeval (p->signal->cstime, &prstatus->pr_cstime); + prstatus->pr_cutime =ns_to_timeval (p->signal->cutime); + prstatus->pr_cstime =ns_to_timeval (p->signal->cstime); prstatus->pr_exec_fdpic_loadmap = p->mm->context.exec_fdpic_loadmap; prstatus->pr_interp_fdpic_loadmap = p->mm->context.interp_fdpic_loadmap;
fs/compat_binfmt_elf.c +2 -16
@@ -51,22 +51,8 @@#define elf_prstatus compat_elf_prstatus#define elf_prpsinfo compat_elf_prpsinfo -/* -* Compat version of cputime_to_compat_timeval, perhaps this -* should be an inline in <linux/compat.h>. -*/ -static void cputime_to_compat_timeval (const cputime_t cputime, -struct compat_timeval *value) -{ -struct timeval tv; -cputime_to_timeval (cputime, &tv); - value->tv_sec = tv.tv_sec; - value->tv_usec = tv.tv_usec; -} - -#undef cputime_to_timeval -#define cputime_to_timeval cputime_to_compat_timeval - +#undef ns_to_timeval +#define ns_to_timeval ns_to_compat_timeval/* * To use this file, asm/elf.h must define compat_elf_check_arch.
fs/jbd2/commit.c +1 -1
@@ -393,7 +393,7 @@ void jbd2_journal_commit_transaction(journal_t *journal)/* Do we need to erase the effects of a prior jbd2_journal_flush? */ if (journal->j_flags &JBD2_FLUSHED ) {jbd_debug (3 ,"super block updated\n" ); -mutex_lock (&journal->j_checkpoint_mutex); +mutex_lock_io (&journal->j_checkpoint_mutex);/* * We hold j_checkpoint_mutex so tail cannot change under us. * We don't need any special data guarantees for writing sb
fs/jbd2/journal.c +6 -6
@@ -944,7 +944,7 @@ int __jbd2_update_log_tail(journal_t *journal, tid_t tid, unsigned long block)*/ void jbd2_update_log_tail (journal_t *journal,tid_t tid,unsigned long block) { -mutex_lock (&journal->j_checkpoint_mutex); +mutex_lock_io (&journal->j_checkpoint_mutex);if (tid_gt (tid, journal->j_tail_sequence))__jbd2_update_log_tail (journal, tid, block);mutex_unlock (&journal->j_checkpoint_mutex);
@@ -1304,7 +1304,7 @@ static int journal_reset(journal_t *journal) journal->j_flags |=JBD2_FLUSHED ; }else {/* Lock here to make assertions happy... */ -mutex_lock (&journal->j_checkpoint_mutex); +mutex_lock_io (&journal->j_checkpoint_mutex);/* * Update log tail information. We use REQ_FUA since new * transaction will start reusing journal space and so we
@@ -1691,7 +1691,7 @@ int jbd2_journal_destroy(journal_t *journal)spin_lock (&journal->j_list_lock);while (journal->j_checkpoint_transactions !=NULL ) {spin_unlock (&journal->j_list_lock); -mutex_lock (&journal->j_checkpoint_mutex); +mutex_lock_io (&journal->j_checkpoint_mutex); err =jbd2_log_do_checkpoint (journal);mutex_unlock (&journal->j_checkpoint_mutex);/*
@@ -1713,7 +1713,7 @@ int jbd2_journal_destroy(journal_t *journal)if (journal->j_sb_buffer) {if (!is_journal_aborted (journal)) { -mutex_lock (&journal->j_checkpoint_mutex); +mutex_lock_io (&journal->j_checkpoint_mutex);write_lock (&journal->j_state_lock); journal->j_tail_sequence =
@@ -1955,7 +1955,7 @@ int jbd2_journal_flush(journal_t *journal)spin_lock (&journal->j_list_lock);while (!err && journal->j_checkpoint_transactions !=NULL ) {spin_unlock (&journal->j_list_lock); -mutex_lock (&journal->j_checkpoint_mutex); +mutex_lock_io (&journal->j_checkpoint_mutex); err =jbd2_log_do_checkpoint (journal);mutex_unlock (&journal->j_checkpoint_mutex);spin_lock (&journal->j_list_lock);
@@ -1965,7 +1965,7 @@ int jbd2_journal_flush(journal_t *journal)if (is_journal_aborted (journal))return -EIO ; -mutex_lock (&journal->j_checkpoint_mutex); +mutex_lock_io (&journal->j_checkpoint_mutex);if (!err) { err =jbd2_cleanup_journal_tail (journal);if (err <0 ) {
fs/proc/array.c +8 -8
@@ -401,8 +401,8 @@ static int do_task_stat(struct seq_file *m, struct pid_namespace *ns,unsigned long long start_time;unsigned long cmin_flt =0 , cmaj_flt =0 ;unsigned long min_flt =0 , maj_flt =0 ; -cputime_t cutime, cstime, utime, stime; -cputime_t cgtime, gtime; +u64 cutime, cstime, utime, stime; +u64 cgtime, gtime;unsigned long rsslim =0 ;char tcomm[sizeof (task->comm)];unsigned long flags;
@@ -497,10 +497,10 @@ static int do_task_stat(struct seq_file *m, struct pid_namespace *ns,seq_put_decimal_ull (m," " , cmin_flt);seq_put_decimal_ull (m," " , maj_flt);seq_put_decimal_ull (m," " , cmaj_flt); -seq_put_decimal_ull (m," " ,cputime_to_clock_t (utime)); -seq_put_decimal_ull (m," " ,cputime_to_clock_t (stime)); -seq_put_decimal_ll (m," " ,cputime_to_clock_t (cutime)); -seq_put_decimal_ll (m," " ,cputime_to_clock_t (cstime)); +seq_put_decimal_ull (m," " ,nsec_to_clock_t (utime)); +seq_put_decimal_ull (m," " ,nsec_to_clock_t (stime)); +seq_put_decimal_ll (m," " ,nsec_to_clock_t (cutime)); +seq_put_decimal_ll (m," " ,nsec_to_clock_t (cstime));seq_put_decimal_ll (m," " , priority);seq_put_decimal_ll (m," " , nice);seq_put_decimal_ll (m," " , num_threads);
@@ -542,8 +542,8 @@ static int do_task_stat(struct seq_file *m, struct pid_namespace *ns,seq_put_decimal_ull (m," " , task->rt_priority);seq_put_decimal_ull (m," " , task->policy);seq_put_decimal_ull (m," " ,delayacct_blkio_ticks (task)); -seq_put_decimal_ull (m," " ,cputime_to_clock_t (gtime)); -seq_put_decimal_ll (m," " ,cputime_to_clock_t (cgtime)); +seq_put_decimal_ull (m," " ,nsec_to_clock_t (gtime)); +seq_put_decimal_ll (m," " ,nsec_to_clock_t (cgtime));if (mm && permitted) {seq_put_decimal_ull (m," " , mm->start_data);
fs/proc/stat.c +32 -32
114 lines not on this page · raw message
fs/proc/uptime.c +2 -5
@@ -5,23 +5,20 @@#include <linux/seq_file.h> #include <linux/time.h> #include <linux/kernel_stat.h> -#include <linux/cputime.h> static int uptime_proc_show (struct seq_file *m,void *v) {struct timespec uptime;struct timespec idle; -u64 idletime;u64 nsec;u32 rem;int i; - idletime =0 ; + nsec =0 ;for_each_possible_cpu (i) - idletime += (__force u64 )kcpustat_cpu (i).cpustat[CPUTIME_IDLE ]; + nsec += (__force u64 )kcpustat_cpu (i).cpustat[CPUTIME_IDLE ];get_monotonic_boottime (&uptime); - nsec =cputime64_to_jiffies64 (idletime) *TICK_NSEC ; idle.tv_sec =div_u64_rem (nsec,NSEC_PER_SEC , &rem); idle.tv_nsec = rem; seq_printf(m, "%lu.%02lu %lu.%02lu\n",
include/asm-generic/cputime.h deleted +0 -15
@@ -1,15 +0,0 @@ -#ifndef _ASM_GENERIC_CPUTIME_H -#define _ASM_GENERIC_CPUTIME_H - -#include <linux/time.h> -#include <linux/jiffies.h> - -#ifndef CONFIG_VIRT_CPU_ACCOUNTING -# include <asm-generic/cputime_jiffies.h> -#endif - -#ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN -# include <asm-generic/cputime_nsecs.h> -#endif - -#endif
include/asm-generic/cputime_jiffies.h deleted +0 -75
75 lines not on this page · raw message
include/asm-generic/cputime_nsecs.h deleted +0 -121
121 lines not on this page · raw message
include/linux/clocksource.h +3 -0
@@ -62,6 +62,8 @@ struct module;* @archdata: arch-specific data * @suspend: suspend function for the clocksource, if necessary * @resume: resume function for the clocksource, if necessary +* @mark_unstable: Optional function to inform the clocksource driver that +* the watchdog marked the clocksource unstable * @owner: module reference, must be set by clocksource in modules * * Note: This struct is not used in hotpathes of the timekeeping code
@@ -93,6 +95,7 @@ struct clocksource {unsigned long flags;void (*suspend)(struct clocksource *cs);void (*resume)(struct clocksource *cs); +void (*mark_unstable)(struct clocksource *cs);/* private: */ #ifdef CONFIG_CLOCKSOURCE_WATCHDOG
include/linux/compat.h +19 -1
@@ -731,7 +731,25 @@ asmlinkage long compat_sys_fanotify_mark(int, unsigned int, __u32, __u32,static inline bool in_compat_syscall (void ) {return is_compat_task (); }#endif -#else +/** +* ns_to_compat_timeval - Compat version of ns_to_timeval +* @nsec: the nanoseconds value to be converted +* +* Returns the compat_timeval representation of the nsec parameter. +*/ +static inline struct compat_timeval ns_to_compat_timeval (s64 nsec) +{ +struct timeval tv; +struct compat_timeval ctv; + + tv =ns_to_timeval (nsec); + ctv.tv_sec = tv.tv_sec; + ctv.tv_usec = tv.tv_usec; + +return ctv; +} + +#else /* !CONFIG_COMPAT */ #define is_compat_task () (0)static inline bool in_compat_syscall (void ) {return false; }
include/linux/cputime.h +2 -5
@@ -1,6 +1,7 @@#ifndef __LINUX_CPUTIME_H#define __LINUX_CPUTIME_H +#ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE #include <asm/cputime.h> #ifndef cputime_to_nsecs
@@ -8,9 +9,5 @@ (cputime_to_usecs(__ct) * NSEC_PER_USEC)#endif -#ifndef nsecs_to_cputime -# define nsecs_to_cputime (__nsecs) \ - usecs_to_cputime((__nsecs) / NSEC_PER_USEC) -#endif - +#endif /* CONFIG_VIRT_CPU_ACCOUNTING_NATIVE */ #endif /* __LINUX_CPUTIME_H */
include/linux/delayacct.h +1 -0
@@ -17,6 +17,7 @@#ifndef _LINUX_DELAYACCT_H#define _LINUX_DELAYACCT_H +#include <uapi/linux/taskstats.h> #include <linux/sched.h> #include <linux/slab.h>
include/linux/jiffies.h +2 -0
@@ -293,6 +293,8 @@ static inline u64 jiffies_to_nsecs(const unsigned long j)return (u64 )jiffies_to_usecs (j) *NSEC_PER_USEC ; } +extern u64 jiffies64_to_nsecs (u64 j); +extern unsigned long __msecs_to_jiffies (const unsigned int m);#if HZ <=MSEC_PER_SEC && !(MSEC_PER_SEC %HZ )/*
include/linux/kernel_stat.h +8 -6
@@ -9,7 +9,6 @@#include <linux/sched.h> #include <linux/vtime.h> #include <asm/irq.h> -#include <linux/cputime.h> /* * 'kernel_stat.h' contains the definitions needed for doing
@@ -78,15 +77,18 @@ static inline unsigned int kstat_cpu_irqs_sum(unsigned int cpu)return kstat_cpu (cpu).irqs_sum; } -extern void account_user_time (struct task_struct *,cputime_t ); -extern void account_system_time (struct task_struct *,int ,cputime_t ); -extern void account_steal_time (cputime_t ); -extern void account_idle_time (cputime_t ); +extern void account_user_time (struct task_struct *,u64 ); +extern void account_guest_time (struct task_struct *,u64 ); +extern void account_system_time (struct task_struct *,int ,u64 ); +extern void account_system_index_time (struct task_struct *,u64 , +enum cpu_usage_stat ); +extern void account_steal_time (u64 ); +extern void account_idle_time (u64 );#ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE static inline void account_process_tick (struct task_struct *tsk,int user) { -vtime_account_user (tsk); +vtime_flush (tsk); }#else extern void account_process_tick (struct task_struct *,int user);
include/linux/mutex.h +4 -0
@@ -156,10 +156,12 @@ extern int __must_check mutex_lock_interruptible_nested(struct mutex *lock, unsigned int subclass);extern int __must_check mutex_lock_killable_nested (struct mutex *lock,unsigned int subclass); +extern void mutex_lock_io_nested (struct mutex *lock,unsigned int subclass);#define mutex_lock (lock) mutex_lock_nested(lock, 0)#define mutex_lock_interruptible (lock) mutex_lock_interruptible_nested(lock, 0)#define mutex_lock_killable (lock) mutex_lock_killable_nested(lock, 0) +#define mutex_lock_io (lock) mutex_lock_io_nested(lock, 0)#define mutex_lock_nest_lock (lock, nest_lock) \ do { \
@@ -171,11 +173,13 @@ do { \extern void mutex_lock (struct mutex *lock);extern int __must_check mutex_lock_interruptible (struct mutex *lock);extern int __must_check mutex_lock_killable (struct mutex *lock); +extern void mutex_lock_io (struct mutex *lock);# define mutex_lock_nested (lock, subclass) mutex_lock(lock)# define mutex_lock_interruptible_nested (lock, subclass) mutex_lock_interruptible(lock)# define mutex_lock_killable_nested (lock, subclass) mutex_lock_killable(lock)# define mutex_lock_nest_lock (lock, nest_lock) mutex_lock(lock) +# define mutex_lock_io_nested (lock, subclass) mutex_lock(lock)#endif /*
include/linux/posix-timers.h +2 -12
@@ -8,19 +8,9 @@#include <linux/alarmtimer.h> -static inline unsigned long long cputime_to_expires (cputime_t expires) -{ -return (__force unsigned long long )expires; -} - -static inline cputime_t expires_to_cputime (unsigned long long expires) -{ -return (__force cputime_t )expires; -} -struct cpu_timer_list {struct list_head entry; -unsigned long long expires, incr; +u64 expires, incr;struct task_struct *task;int firing; };
@@ -129,7 +119,7 @@ void run_posix_cpu_timers(struct task_struct *task);void posix_cpu_timers_exit (struct task_struct *task);void posix_cpu_timers_exit_group (struct task_struct *task);void set_process_cpu_timer (struct task_struct *task,unsigned int clock_idx, -cputime_t *newval,cputime_t *oldval); +u64 *newval,u64 *oldval);long clock_nanosleep_restart (struct restart_block *restart_block);
include/linux/sched.h +38 -42
199 lines not on this page · raw message
include/linux/sched/sysctl.h +1 -0
@@ -59,6 +59,7 @@ extern unsigned int sysctl_sched_cfs_bandwidth_slice;extern unsigned int sysctl_sched_autogroup_enabled;#endif +extern int sysctl_sched_rr_timeslice;extern int sched_rr_timeslice; extern int sched_rr_handler(struct ctl_table *table, int write,
include/linux/vtime.h +5 -2
@@ -58,27 +58,28 @@ static inline void vtime_task_switch(struct task_struct *prev)extern void vtime_account_system (struct task_struct *tsk);extern void vtime_account_idle (struct task_struct *tsk); -extern void vtime_account_user (struct task_struct *tsk);#else /* !CONFIG_VIRT_CPU_ACCOUNTING */ static inline void vtime_task_switch (struct task_struct *prev) { }static inline void vtime_account_system (struct task_struct *tsk) { } -static inline void vtime_account_user (struct task_struct *tsk) { }#endif /* !CONFIG_VIRT_CPU_ACCOUNTING */ #ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN extern void arch_vtime_task_switch (struct task_struct *tsk); +extern void vtime_account_user (struct task_struct *tsk);extern void vtime_user_enter (struct task_struct *tsk);static inline void vtime_user_exit (struct task_struct *tsk) {vtime_account_user (tsk); } +extern void vtime_guest_enter (struct task_struct *tsk);extern void vtime_guest_exit (struct task_struct *tsk);extern void vtime_init_idle (struct task_struct *tsk,int cpu);#else /* !CONFIG_VIRT_CPU_ACCOUNTING_GEN */ +static inline void vtime_account_user (struct task_struct *tsk) { }static inline void vtime_user_enter (struct task_struct *tsk) { }static inline void vtime_user_exit (struct task_struct *tsk) { }static inline void vtime_guest_enter (struct task_struct *tsk) { }
@@ -93,9 +94,11 @@ static inline void vtime_account_irq_exit(struct task_struct *tsk)/* On hard|softirq exit we always account to hard|softirq cputime */ vtime_account_system(tsk); } +extern void vtime_flush (struct task_struct *tsk);#else /* !CONFIG_VIRT_CPU_ACCOUNTING_NATIVE */ static inline void vtime_account_irq_enter (struct task_struct *tsk) { }static inline void vtime_account_irq_exit (struct task_struct *tsk) { } +static inline void vtime_flush (struct task_struct *tsk) { }#endif
include/trace/events/timer.h +13 -13
@@ -269,17 +269,17 @@ DEFINE_EVENT(hrtimer_class, hrtimer_cancel, TRACE_EVENT(itimer_state, TP_PROTO(int which, const struct itimerval *const value, - cputime_t expires), + unsigned long long expires), TP_ARGS(which, value, expires), TP_STRUCT__entry( - __field( int, which ) - __field( cputime_t, expires ) - __field( long, value_sec ) - __field( long, value_usec ) - __field( long, interval_sec ) - __field( long, interval_usec ) + __field( int, which ) + __field( unsigned long long, expires ) + __field( long, value_sec ) + __field( long, value_usec ) + __field( long, interval_sec ) + __field( long, interval_usec ) ), TP_fast_assign(
@@ -292,7 +292,7 @@ TRACE_EVENT(itimer_state, ),TP_printk ("which=%d expires=%llu it_value=%ld.%ld it_interval=%ld.%ld" , - __entry->which, (unsigned long long )__entry->expires, + __entry->which, __entry->expires, __entry->value_sec, __entry->value_usec, __entry->interval_sec, __entry->interval_usec) );
@@ -305,14 +305,14 @@ TRACE_EVENT(itimer_state,*/ TRACE_EVENT(itimer_expire, - TP_PROTO(int which, struct pid *pid, cputime_t now), + TP_PROTO(int which, struct pid *pid, unsigned long long now), TP_ARGS(which, pid, now), TP_STRUCT__entry( - __field( int , which ) - __field( pid_t, pid ) - __field( cputime_t, now ) + __field( int , which ) + __field( pid_t, pid ) + __field( unsigned long long, now ) ), TP_fast_assign(
@@ -322,7 +322,7 @@ TRACE_EVENT(itimer_expire, ),TP_printk ("which=%d pid=%d now=%llu" , __entry->which, - (int ) __entry->pid, (unsigned long long )__entry->now) + (int ) __entry->pid, __entry->now) );#ifdef CONFIG_NO_HZ_COMMON
init/main.c +0 -1
@@ -625,7 +625,6 @@ asmlinkage __visible void __init start_kernel(void)numa_policy_init ();if (late_time_init)late_time_init (); -sched_clock_init ();calibrate_delay ();pidmap_init ();anon_vma_init ();
kernel/acct.c +4 -3
@@ -453,8 +453,8 @@ static void fill_ac(acct_t *ac)spin_lock_irq (¤t->sighand->siglock); tty = current->signal->tty;/* Safe as we hold the siglock */ ac->ac_tty = tty ?old_encode_dev (tty_devnum (tty)) :0 ; - ac->ac_utime =encode_comp_t (jiffies_to_AHZ (cputime_to_jiffies (pacct->ac_utime))); - ac->ac_stime =encode_comp_t (jiffies_to_AHZ (cputime_to_jiffies (pacct->ac_stime))); + ac->ac_utime =encode_comp_t (nsec_to_AHZ (pacct->ac_utime)); + ac->ac_stime =encode_comp_t (nsec_to_AHZ (pacct->ac_stime)); ac->ac_flag = pacct->ac_flag; ac->ac_mem =encode_comp_t (pacct->ac_mem); ac->ac_minflt =encode_comp_t (pacct->ac_minflt);
@@ -530,7 +530,7 @@ static void do_acct_process(struct bsd_acct_struct *acct)void acct_collect (long exitcode,int group_dead) {struct pacct_struct *pacct = ¤t->signal->pacct; -cputime_t utime, stime; +u64 utime, stime;unsigned long vsize =0 ;if (group_dead && current->mm) {
@@ -559,6 +559,7 @@ void acct_collect(long exitcode, int group_dead) pacct->ac_flag |=ACORE ;if (current->flags &PF_SIGNALED ) pacct->ac_flag |=AXSIG ; +task_cputime (current, &utime, &stime); pacct->ac_utime += utime; pacct->ac_stime += stime;
kernel/delayacct.c +3 -3
@@ -82,19 +82,19 @@ void __delayacct_blkio_end(void)int __delayacct_add_tsk (struct taskstats *d,struct task_struct *tsk) { -cputime_t utime, stime, stimescaled, utimescaled; +u64 utime, stime, stimescaled, utimescaled;unsigned long long t2, t3;unsigned long flags, t1;s64 tmp;task_cputime (tsk, &utime, &stime); tmp = (s64 )d->cpu_run_real_total; - tmp +=cputime_to_nsecs (utime + stime); + tmp += utime + stime; d->cpu_run_real_total = (tmp < (s64 )d->cpu_run_real_total) ?0 : tmp;task_cputime_scaled (tsk, &utimescaled, &stimescaled); tmp = (s64 )d->cpu_scaled_run_real_total; - tmp +=cputime_to_nsecs (utimescaled + stimescaled); + tmp += utimescaled + stimescaled; d->cpu_scaled_run_real_total = (tmp < (s64 )d->cpu_scaled_run_real_total) ?0 : tmp;
kernel/exit.c +2 -2
@@ -86,7 +86,7 @@ static void __exit_signal(struct task_struct *tsk)bool group_dead =thread_group_leader (tsk);struct sighand_struct *sighand;struct tty_struct *uninitialized_var (tty ); -cputime_t utime, stime; +u64 utime, stime; sighand =rcu_dereference_check (tsk->sighand,lockdep_tasklist_lock_is_held ());
@@ -1091,7 +1091,7 @@ static int wait_task_zombie(struct wait_opts *wo, struct task_struct *p)struct signal_struct *sig = p->signal;struct signal_struct *psig = current->signal;unsigned long maxrss; -cputime_t tgutime, tgstime; +u64 tgutime, tgstime;/* * The resource counters for the group leader are in its
kernel/fork.c +1 -1
@@ -1313,7 +1313,7 @@ static void posix_cpu_timers_init_group(struct signal_struct *sig) cpu_limit =READ_ONCE (sig->rlim[RLIMIT_CPU ].rlim_cur);if (cpu_limit !=RLIM_INFINITY ) { - sig->cputime_expires.prof_exp =secs_to_cputime (cpu_limit); + sig->cputime_expires.prof_exp = cpu_limit *NSEC_PER_SEC ; sig->cputimer.running = true; }
kernel/locking/mutex.c +24 -0
@@ -783,6 +783,20 @@ mutex_lock_interruptible_nested(struct mutex *lock, unsigned int subclass) }EXPORT_SYMBOL_GPL (mutex_lock_interruptible_nested); +void __sched +mutex_lock_io_nested (struct mutex *lock,unsigned int subclass) +{ +int token; + +might_sleep (); + + token =io_schedule_prepare (); +__mutex_lock_common (lock,TASK_UNINTERRUPTIBLE , + subclass,NULL , _RET_IP_,NULL ,0 ); +io_schedule_finish (token); +} +EXPORT_SYMBOL_GPL (mutex_lock_io_nested); +static inline int ww_mutex_deadlock_injection (struct ww_mutex *lock,struct ww_acquire_ctx *ctx) {
@@ -950,6 +964,16 @@ int __sched mutex_lock_killable(struct mutex *lock) }EXPORT_SYMBOL (mutex_lock_killable); +void __sched mutex_lock_io(struct mutex *lock) +{ +int token; + + token =io_schedule_prepare (); +mutex_lock (lock); +io_schedule_finish (token); +} +EXPORT_SYMBOL_GPL (mutex_lock_io); + static noinline void __sched__mutex_lock_slowpath (struct mutex *lock) {
kernel/sched/Makefile +2 -2
@@ -18,8 +18,8 @@ endif obj-y += core.o loadavg.o clock.o cputime.o obj-y += idle_task.o fair.o rt.o deadline.o stop_task.o obj-y += wait.o swait.o completion.o idle.o -obj-$(CONFIG_SMP) += cpupri.o cpudeadline.o -obj-$(CONFIG_SCHED_AUTOGROUP) += auto_group.o +obj-$(CONFIG_SMP) += cpupri.o cpudeadline.o topology.o +obj-$(CONFIG_SCHED_AUTOGROUP) += autogroup.o obj-$(CONFIG_SCHEDSTATS) += stats.o obj-$(CONFIG_SCHED_DEBUG) += debug.o obj-$(CONFIG_CGROUP_CPUACCT) += cpuacct.o
kernel/sched/autogroup.c renamed from kernel/sched/auto_group.c +0 -0
kernel/sched/autogroup.h renamed from kernel/sched/auto_group.h +0 -0
kernel/sched/clock.c +83 -75
133 lines not on this page · raw message
kernel/sched/core.c +388 -1967
2,355 lines not on this page · raw message
kernel/sched/cputime.c +74 -104
178 lines not on this page · raw message
kernel/sched/fair.c +68 -26
94 lines not on this page · raw message
kernel/sched/sched.h +118 -19
137 lines not on this page · raw message
kernel/sched/topology.c new file +1658 -0
1,658 lines not on this page · raw message
kernel/time/itimer.c +20 -40
60 lines not on this page · raw message
kernel/time/posix-cpu-timers.c +59 -111
170 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Part of the diff is not shown here. View the raw message.
Hmm. The scheduler changes seem to show problems with suspend/resume.
I now get his when suspending:
...
Disabling non-boot CPUs ...
Cannot set affinity for irq 285
smpboot: CPU 1 is now offline
------------[ cut here ]------------
WARNING: CPU: 2 PID: 25 at kernel/sched/sched.h:812
update_load_avg+0x779/0xa70
rq->clock_update_flags < RQCF_ACT_SKIP
...
Call Trace:
update_load_avg+0x779/0xa70
set_next_entity+0xd9/0x220
pick_next_task_fair+0x88/0x550
sched_cpu_dying+0x1cf/0x2a0
cpuhp_invoke_callback+0x80/0x3b0
take_cpu_down+0x5e/0xa0
multi_cpu_stop+0xb6/0xe0the issue may have been going on for a while, but the new WARN_ON() was added in this merge window.
(Not sure how consistent this warning is, it definitely doesn't happen every time, I've only seen it once)
Linus
Quoted 22 lines · Linus Torvalds
Hmm. The scheduler changes seem to show problems with suspend/resume.
I now get his when suspending:
...
Disabling non-boot CPUs ...
Cannot set affinity for irq 285
smpboot: CPU 1 is now offline------------[ cut here ]------------ WARNING: CPU: 2 PID: 25 at kernel/sched/sched.h:812 update_load_avg+0x779/0xa70 rq->clock_update_flags < RQCF_ACT_SKIP ... Call Trace: update_load_avg+0x779/0xa70 set_next_entity+0xd9/0x220 pick_next_task_fair+0x88/0x550 sched_cpu_dying+0x1cf/0x2a0 cpuhp_invoke_callback+0x80/0x3b0 take_cpu_down+0x5e/0xa0 multi_cpu_stop+0xb6/0xe0
Quoted 5 lines
the issue may have been going on for a while, but the new
WARN_ON()was added in this merge window.(Not sure how consistent this warning is, it definitely doesn't happen every time, I've only seen it once)
I think Peter has the fix for this somewhere, but it doesn't look like it made it to tip/sched/core.
Peter, this is the original patch,
Peter Zijlstra
maintainerQuoted 8 lines · Matt Fleming
On Wed, 22 Feb, at 12:41:01PM, Linus Torvalds wrote:
I think Peter has the fix for this somewhere, but it doesn't look like it made it to tip/sched/core.
Peter, this is the original patch,
I have it, send it to Ingo the day he send out the pull requests.
Quoted 11 lines · Peter Zijlstra
Quoted 8 lines · Matt Fleming
On Wed, 22 Feb, at 12:41:01PM, Linus Torvalds wrote:
I think Peter has the fix for this somewhere, but it doesn't look like it made it to tip/sched/core.
Peter, this is the original patch,
I have it, send it to Ingo the day he send out the pull requests.
Thanks - will send this to Linus ASAP!
Thanks,
Ingo