diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-01 13:43:39 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-01 13:43:39 -0400 |
| commit | 0b981cb94bc63a2d0e5eccccdca75fe57643ffce (patch) | |
| tree | 966ad6e6807fd1041d9962c9904e032a5ab07a65 | |
| parent | 4cba3335826cbb36a218c3f5a1387e2c7c7ca9aa (diff) | |
| parent | fdf9c356502ae02238efcdf90cefd7b473a63fd4 (diff) | |
Merge branch 'sched-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull scheduler changes from Ingo Molnar:
"Continued quest to clean up and enhance the cputime code by Frederic
Weisbecker, in preparation for future tickless kernel features.
Other than that, smallish changes."
Fix up trivial conflicts due to additions next to each other in arch/{x86/}Kconfig
* 'sched-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (24 commits)
cputime: Make finegrained irqtime accounting generally available
cputime: Gather time/stats accounting config options into a single menu
ia64: Reuse system and user vtime accounting functions on task switch
ia64: Consolidate user vtime accounting
vtime: Consolidate system/idle context detection
cputime: Use a proper subsystem naming for vtime related APIs
sched: cpu_power: enable ARCH_POWER
sched/nohz: Clean up select_nohz_load_balancer()
sched: Fix load avg vs. cpu-hotplug
sched: Remove __ARCH_WANT_INTERRUPTS_ON_CTXSW
sched: Fix nohz_idle_balance()
sched: Remove useless code in yield_to()
sched: Add time unit suffix to sched sysctl knobs
sched/debug: Limit sd->*_idx range on sysctl
sched: Remove AFFINE_WAKEUPS feature flag
s390: Remove leftover account_tick_vtime() header
cputime: Consolidate vtime handling on context switch
sched: Move cputime code to its own file
cputime: Generalize CONFIG_VIRT_CPU_ACCOUNTING
tile: Remove SD_PREFER_LOCAL leftover
...
32 files changed, 892 insertions, 906 deletions
diff --git a/Documentation/scheduler/sched-arch.txt b/Documentation/scheduler/sched-arch.txt index 28aa1075e291..b1b8587b86f0 100644 --- a/Documentation/scheduler/sched-arch.txt +++ b/Documentation/scheduler/sched-arch.txt | |||
| @@ -17,16 +17,6 @@ you must `#define __ARCH_WANT_UNLOCKED_CTXSW` in a header file | |||
| 17 | Unlocked context switches introduce only a very minor performance | 17 | Unlocked context switches introduce only a very minor performance |
| 18 | penalty to the core scheduler implementation in the CONFIG_SMP case. | 18 | penalty to the core scheduler implementation in the CONFIG_SMP case. |
| 19 | 19 | ||
| 20 | 2. Interrupt status | ||
| 21 | By default, the switch_to arch function is called with interrupts | ||
| 22 | disabled. Interrupts may be enabled over the call if it is likely to | ||
| 23 | introduce a significant interrupt latency by adding the line | ||
| 24 | `#define __ARCH_WANT_INTERRUPTS_ON_CTXSW` in the same place as for | ||
| 25 | unlocked context switches. This define also implies | ||
| 26 | `__ARCH_WANT_UNLOCKED_CTXSW`. See arch/arm/include/asm/system.h for an | ||
| 27 | example. | ||
| 28 | |||
| 29 | |||
| 30 | CPU idle | 20 | CPU idle |
| 31 | ======== | 21 | ======== |
| 32 | Your cpu_idle routines need to obey the following rules: | 22 | Your cpu_idle routines need to obey the following rules: |
diff --git a/arch/Kconfig b/arch/Kconfig index 1a7b468abf4a..a62965d057f6 100644 --- a/arch/Kconfig +++ b/arch/Kconfig | |||
| @@ -304,4 +304,13 @@ config HAVE_RCU_USER_QS | |||
| 304 | are already protected inside rcu_irq_enter/rcu_irq_exit() but | 304 | are already protected inside rcu_irq_enter/rcu_irq_exit() but |
| 305 | preemption or signal handling on irq exit still need to be protected. | 305 | preemption or signal handling on irq exit still need to be protected. |
| 306 | 306 | ||
| 307 | config HAVE_VIRT_CPU_ACCOUNTING | ||
| 308 | bool | ||
| 309 | |||
| 310 | config HAVE_IRQ_TIME_ACCOUNTING | ||
| 311 | bool | ||
| 312 | help | ||
| 313 | Archs need to ensure they use a high enough resolution clock to | ||
| 314 | support irq time accounting and then call enable_sched_clock_irqtime(). | ||
| 315 | |||
| 307 | source "kernel/gcov/Kconfig" | 316 | source "kernel/gcov/Kconfig" |
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig index 310cf5781fad..3c720ef6c32d 100644 --- a/arch/ia64/Kconfig +++ b/arch/ia64/Kconfig | |||
| @@ -25,6 +25,7 @@ config IA64 | |||
| 25 | select HAVE_GENERIC_HARDIRQS | 25 | select HAVE_GENERIC_HARDIRQS |
| 26 | select HAVE_MEMBLOCK | 26 | select HAVE_MEMBLOCK |
| 27 | select HAVE_MEMBLOCK_NODE_MAP | 27 | select HAVE_MEMBLOCK_NODE_MAP |
| 28 | select HAVE_VIRT_CPU_ACCOUNTING | ||
| 28 | select ARCH_DISCARD_MEMBLOCK | 29 | select ARCH_DISCARD_MEMBLOCK |
| 29 | select GENERIC_IRQ_PROBE | 30 | select GENERIC_IRQ_PROBE |
| 30 | select GENERIC_PENDING_IRQ if SMP | 31 | select GENERIC_PENDING_IRQ if SMP |
| @@ -340,17 +341,6 @@ config FORCE_MAX_ZONEORDER | |||
| 340 | default "17" if HUGETLB_PAGE | 341 | default "17" if HUGETLB_PAGE |
| 341 | default "11" | 342 | default "11" |
| 342 | 343 | ||
| 343 | config VIRT_CPU_ACCOUNTING | ||
| 344 | bool "Deterministic task and CPU time accounting" | ||
| 345 | default n | ||
| 346 | help | ||
| 347 | Select this option to enable more accurate task and CPU time | ||
| 348 | accounting. This is done by reading a CPU counter on each | ||
| 349 | kernel entry and exit and on transitions within the kernel | ||
| 350 | between system, softirq and hardirq state, so there is a | ||
| 351 | small performance impact. | ||
| 352 | If in doubt, say N here. | ||
| 353 | |||
| 354 | config SMP | 344 | config SMP |
| 355 | bool "Symmetric multi-processing support" | 345 | bool "Symmetric multi-processing support" |
| 356 | select USE_GENERIC_SMP_HELPERS | 346 | select USE_GENERIC_SMP_HELPERS |
diff --git a/arch/ia64/include/asm/switch_to.h b/arch/ia64/include/asm/switch_to.h index cb2412fcd17f..d38c7ea5eea5 100644 --- a/arch/ia64/include/asm/switch_to.h +++ b/arch/ia64/include/asm/switch_to.h | |||
| @@ -30,13 +30,6 @@ extern struct task_struct *ia64_switch_to (void *next_task); | |||
| 30 | extern void ia64_save_extra (struct task_struct *task); | 30 | extern void ia64_save_extra (struct task_struct *task); |
| 31 | extern void ia64_load_extra (struct task_struct *task); | 31 | extern void ia64_load_extra (struct task_struct *task); |
| 32 | 32 | ||
| 33 | #ifdef CONFIG_VIRT_CPU_ACCOUNTING | ||
| 34 | extern void ia64_account_on_switch (struct task_struct *prev, struct task_struct *next); | ||
| 35 | # define IA64_ACCOUNT_ON_SWITCH(p,n) ia64_account_on_switch(p,n) | ||
| 36 | #else | ||
| 37 | # define IA64_ACCOUNT_ON_SWITCH(p,n) | ||
| 38 | #endif | ||
| 39 | |||
| 40 | #ifdef CONFIG_PERFMON | 33 | #ifdef CONFIG_PERFMON |
| 41 | DECLARE_PER_CPU(unsigned long, pfm_syst_info); | 34 | DECLARE_PER_CPU(unsigned long, pfm_syst_info); |
| 42 | # define PERFMON_IS_SYSWIDE() (__get_cpu_var(pfm_syst_info) & 0x1) | 35 | # define PERFMON_IS_SYSWIDE() (__get_cpu_var(pfm_syst_info) & 0x1) |
| @@ -49,7 +42,6 @@ extern void ia64_account_on_switch (struct task_struct *prev, struct task_struct | |||
| 49 | || PERFMON_IS_SYSWIDE()) | 42 | || PERFMON_IS_SYSWIDE()) |
| 50 | 43 | ||
| 51 | #define __switch_to(prev,next,last) do { \ | 44 | #define __switch_to(prev,next,last) do { \ |
| 52 | IA64_ACCOUNT_ON_SWITCH(prev, next); \ | ||
| 53 | if (IA64_HAS_EXTRA_STATE(prev)) \ | 45 | if (IA64_HAS_EXTRA_STATE(prev)) \ |
| 54 | ia64_save_extra(prev); \ | 46 | ia64_save_extra(prev); \ |
| 55 | if (IA64_HAS_EXTRA_STATE(next)) \ | 47 | if (IA64_HAS_EXTRA_STATE(next)) \ |
diff --git a/arch/ia64/kernel/time.c b/arch/ia64/kernel/time.c index ecc904b33c5f..80ff9acc5edf 100644 --- a/arch/ia64/kernel/time.c +++ b/arch/ia64/kernel/time.c | |||
| @@ -83,32 +83,36 @@ static struct clocksource *itc_clocksource; | |||
| 83 | 83 | ||
| 84 | extern cputime_t cycle_to_cputime(u64 cyc); | 84 | extern cputime_t cycle_to_cputime(u64 cyc); |
| 85 | 85 | ||
| 86 | static void vtime_account_user(struct task_struct *tsk) | ||
| 87 | { | ||
| 88 | cputime_t delta_utime; | ||
| 89 | struct thread_info *ti = task_thread_info(tsk); | ||
| 90 | |||
| 91 | if (ti->ac_utime) { | ||
| 92 | delta_utime = cycle_to_cputime(ti->ac_utime); | ||
| 93 | account_user_time(tsk, delta_utime, delta_utime); | ||
| 94 | ti->ac_utime = 0; | ||
| 95 | } | ||
| 96 | } | ||
| 97 | |||
| 86 | /* | 98 | /* |
| 87 | * Called from the context switch with interrupts disabled, to charge all | 99 | * Called from the context switch with interrupts disabled, to charge all |
| 88 | * accumulated times to the current process, and to prepare accounting on | 100 | * accumulated times to the current process, and to prepare accounting on |
| 89 | * the next process. | 101 | * the next process. |
| 90 | */ | 102 | */ |
| 91 | void ia64_account_on_switch(struct task_struct *prev, struct task_struct *next) | 103 | void vtime_task_switch(struct task_struct *prev) |
| 92 | { | 104 | { |
| 93 | struct thread_info *pi = task_thread_info(prev); | 105 | struct thread_info *pi = task_thread_info(prev); |
| 94 | struct thread_info *ni = task_thread_info(next); | 106 | struct thread_info *ni = task_thread_info(current); |
| 95 | cputime_t delta_stime, delta_utime; | ||
| 96 | __u64 now; | ||
