scheduler changes for v4.7
Subsystems (15)
Ingo Molnar
maintainerLinus,
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: ef0491ea17f8019821c7e9c8e801184ecf17f85a ARM: Hide finish_arch_post_lock_switch() from modules
- massive CPU hotplug rework (Thomas Gleixner)
- improve migration fairness (Peter Zijlstra)
- CPU load calculation updates/cleanups (Yuyang Du)
- cpufreq updates (Steve Muckle)
- nohz optimizations (Frederic Weisbecker)
- switch_mm() micro-optimization on x86 (Andy Lutomirski)
- ... lots of other enhancements, fixes and cleanups.
Thanks,
Ingo
------------------>
Alexander Shishkin (1):
perf/core, sched: Don't use clock function pointer to determine clock
Andy Lutomirski (5):
sched/core, ARM: Include linux/preempt.h from asm/mmu_context.h sched/core: Add switch_mm_irqs_off() and use it in the scheduler x86/mm: Build arch/x86/mm/tlb.c even on !SMP
x86/mm, sched/core: Uninline switch_mm()
x86/mm, sched/core: Turn off IRQs in switch_mm()
Anton Blanchard (1):
sched/cpuacct: Check for NULL when using task_pt_regs()
Daniel Lezcano (2):
sched/clock: Remove pointless test in cpu_clock/local_clock sched/clock: Make local_clock()/cpu_clock() inline
Davidlohr Bueso (1):
sched/core: Fix comment typo in wake_q_add()
Dietmar Eggemann (2):
sched/fair: Remove stale power aware scheduling comments sched/fair: Fix comment in calculate_imbalance()
Dongsheng Yang (1):
sched/cpuacct: Split usage accounting into user_usage and sys_usage
Frederic Weisbecker (3):
sched/fair: Gather CPU load functions under a more conventional namespace sched/fair: Correctly handle nohz ticks CPU load accounting sched/fair: Optimize !CONFIG_NO_HZ_COMMON CPU load updates
Ingo Molnar (1):
mm/mmu_context, sched/core: Fix mmu_context.h assumption
Matt Fleming (1):
sched/fair: Update rq clock before updating nohz CPU load
Morten Rasmussen (1):
sched/fair: Correct unit of load_above_capacity
Muhammad Falak R Wani (1):
sched/core: Remove unused variable
Peter Zijlstra (10):
sched/core: Move task_rq_lock() out of line
sched/core: Introduce 'struct rq_flags'
locking/lockdep, sched/core: Implement a better lock pinning scheme sched/core: Enable increased load resolution on 64-bit kernels sched/hotplug: Move sync_rcu to be with set_cpu_active(false) sched/fair: Move record_wakee()
sched/fair: Prepare to fix fairness problems on migration sched/core: Kill sched_class::task_waking to clean up the migration logic sched/fair: Fix fairness issue on migration
sched/fair: Clean up scale confusion
Peter Zijlstra (Intel) (1):
sched: Allow per-cpu kernel threads to run on online && !active
Rabin Vincent (1):
sched/debug: Don't dump sched debug info in SysRq-W
Srikar Dronamraju (2):
sched/fair: Reset nr_balance_failed after active balancing sched/fair: Fix asym packing to select correct CPU
Steve Muckle (3):
sched/fair: Move cpufreq hook to update_cfs_rq_load_avg() sched/fair: Do not call cpufreq hook unless util changed sched/fair: Call cpufreq hook in additional paths
Steven Rostedt (2):
sched/core: Add preempt checks in preempt_schedule() code
ARM: Hide finish_arch_post_lock_switch() from modules
Thomas Gleixner (14):
sched: Make set_cpu_rq_start_time() a built in hotplug state
sched: Allow hotplug notifiers to be setup early
sched: Consolidate the notifier maze
sched: Move sched_domains_numa_masks_clear() to DOWN_PREPARE sched/hotplug: Convert cpu_[in]active notifiers to state machine sched/migration: Move prepare transition to SCHED_STARTING state sched/migration: Move calc_load_migrate() into CPU_DYING sched/migration: Move CPU_ONLINE into scheduler state sched/hotplug: Move migration CPU_DYING to sched_cpu_dying() sched/hotplug: Make activate() the last hotplug step sched/fair: Make ilb_notifier an explicit call
sched: Make hrtick_notifier an explicit call
sched/core: Use tsk_cpus_allowed() instead of accessing ->cpus_allowed sched/core: Provide a tsk_nr_cpus_allowed() helper
Tim Chen (1):
sched/numa: Remove unnecessary NUMA dequeue update from non-SMP kernels
Vik Heyndrickx (1):
sched/loadavg: Fix loadavg artifacts on fully idle and on fully loaded systems
Wanpeng Li (3):
sched/cpufreq: Optimize cpufreq update kicker to avoid update multiple times sched/debug: Print out idle balance values even on !CONFIG_SCHEDSTATS kernels sched/nohz: Fix affine unpinned timers mess
Xunlei Pang (1):
sched/deadline: Fix a bug in dl_overflow()
Yuyang Du (6):
sched/fair: Update comments after a variable rename
sched/fair: Initiate a new task's util avg to a bounded value sched/fair: Generalize the load/util averages resolution definition sched/fair: Rename SCHED_LOAD_SHIFT to NICE_0_LOAD_SHIFT and remove SCHED_LOAD_SCALE sched/fair: Add detailed description to the sched load avg metrics sched/fair: Optimize sum computation with a lookup table
Zhao Lei (1):
sched/cpuacct: Show all possible CPUs in cpuacct output
Documentation/trace/ftrace.txt | 10 +- arch/arm/include/asm/mmu_context.h | 3 + arch/powerpc/kernel/smp.c | 2 +- arch/s390/kernel/smp.c | 2 +- arch/x86/events/core.c | 2 +- arch/x86/include/asm/mmu_context.h | 101 +---- arch/x86/mm/Makefile | 3 +- arch/x86/mm/tlb.c | 116 ++++++ include/linux/cpu.h | 18 - include/linux/cpuhotplug.h | 2 + include/linux/cpumask.h | 6 +- include/linux/lockdep.h | 23 +- include/linux/mmu_context.h | 7 + include/linux/sched.h | 124 +++++- kernel/cpu.c | 32 +- kernel/locking/lockdep.c | 71 +++- kernel/sched/clock.c | 48 +-- kernel/sched/core.c | 749 +++++++++++++++++++++---------------- kernel/sched/cpuacct.c | 147 ++++++-- kernel/sched/cpudeadline.c | 4 +- kernel/sched/cpupri.c | 4 +- kernel/sched/deadline.c | 55 +-- kernel/sched/debug.c | 10 +- kernel/sched/fair.c | 513 ++++++++++++++++--------- kernel/sched/idle_task.c | 2 +- kernel/sched/loadavg.c | 11 +- kernel/sched/rt.c | 38 +- kernel/sched/sched.h | 140 +++---- kernel/sched/stop_task.c | 2 +- kernel/time/tick-sched.c | 9 +- mm/mmu_context.c | 2 +- 31 files changed, 1329 insertions(+), 927 deletions(-)
Documentation/trace/ftrace.txt +5 -5
@@ -1562,12 +1562,12 @@ Doing the same with chrt -r 5 and function-trace set. <idle>-0 3dN.1 12us : menu_hrtimer_cancel <-tick_nohz_idle_exit <idle>-0 3dN.1 12us : ktime_get <-tick_nohz_idle_exit <idle>-0 3dN.1 12us : tick_do_update_jiffies64 <-tick_nohz_idle_exit - <idle>-0 3dN.1 13us : update_cpu_load_nohz <-tick_nohz_idle_exit - <idle>-0 3dN.1 13us : _raw_spin_lock <-update_cpu_load_nohz + <idle>-0 3dN.1 13us : cpu_load_update_nohz <-tick_nohz_idle_exit + <idle>-0 3dN.1 13us : _raw_spin_lock <-cpu_load_update_nohz <idle>-0 3dN.1 13us : add_preempt_count <-_raw_spin_lock - <idle>-0 3dN.2 13us : __update_cpu_load <-update_cpu_load_nohz - <idle>-0 3dN.2 14us : sched_avg_update <-__update_cpu_load - <idle>-0 3dN.2 14us : _raw_spin_unlock <-update_cpu_load_nohz + <idle>-0 3dN.2 13us : __cpu_load_update <-cpu_load_update_nohz + <idle>-0 3dN.2 14us : sched_avg_update <-__cpu_load_update + <idle>-0 3dN.2 14us : _raw_spin_unlock <-cpu_load_update_nohz <idle>-0 3dN.2 14us : sub_preempt_count <-_raw_spin_unlock <idle>-0 3dN.1 15us : calc_load_exit_idle <-tick_nohz_idle_exit <idle>-0 3dN.1 15us : touch_softlockup_watchdog <-tick_nohz_idle_exit
arch/arm/include/asm/mmu_context.h +3 -0
@@ -15,6 +15,7 @@#include <linux/compiler.h> #include <linux/sched.h> +#include <linux/preempt.h> #include <asm/cacheflush.h> #include <asm/cachetype.h> #include <asm/proc-fns.h>
@@ -66,6 +67,7 @@ static inline void check_and_switch_context(struct mm_struct *mm,cpu_switch_mm (mm->pgd, mm); } +#ifndef MODULE #define finish_arch_post_lock_switch \ finish_arch_post_lock_switchstatic inline void finish_arch_post_lock_switch (void )
@@ -87,6 +89,7 @@ static inline void finish_arch_post_lock_switch(void)preempt_enable_no_resched (); } } +#endif /* !MODULE */ #endif /* CONFIG_MMU */
arch/powerpc/kernel/smp.c +1 -1
@@ -565,7 +565,7 @@ int __cpu_up(unsigned int cpu, struct task_struct *tidle) smp_ops->give_timebase ();/* Wait until cpu puts itself in the online & active maps */ -while (!cpu_online (cpu) || !cpu_active (cpu)) +while (!cpu_online (cpu))cpu_relax ();return 0 ;
arch/s390/kernel/smp.c +1 -1
@@ -832,7 +832,7 @@ int __cpu_up(unsigned int cpu, struct task_struct *tidle)pcpu_attach_task (pcpu, tidle);pcpu_start_fn (pcpu, smp_start_secondary,NULL );/* Wait until cpu puts itself in the online & active maps */ -while (!cpu_online (cpu) || !cpu_active (cpu)) +while (!cpu_online (cpu))cpu_relax ();return 0 ; }
arch/x86/events/core.c +1 -1
@@ -2177,7 +2177,7 @@ void arch_perf_update_userpage(struct perf_event *event,* cap_user_time_zero doesn't make sense when we're using a different * time base for the records. */ -if (event->clock == &local_clock) { +if (!event->attr.use_clockid) { userpg->cap_user_time_zero =1 ; userpg->time_zero = data->cyc2ns_offset; }
arch/x86/include/asm/mmu_context.h +5 -96
108 lines not on this page · raw message
arch/x86/mm/Makefile +1 -2
@@ -2,7 +2,7 @@ KCOV_INSTRUMENT_tlb.o := n obj-y := init.o init_$(BITS).o fault.o ioremap.o extable.o pageattr.o mmap.o \ - pat.o pgtable.o physaddr.o gup.o setup_nx.o + pat.o pgtable.o physaddr.o gup.o setup_nx.o tlb.o # Make sure __phys_addr has no stackprotector nostackp := $(call cc-option, -fno-stack-protector)
@@ -12,7 +12,6 @@ CFLAGS_setup_nx.o := $(nostackp) CFLAGS_fault.o := -I$(src)/../include/asm/trace obj-$(CONFIG_X86_PAT) += pat_rbtree.o -obj-$(CONFIG_SMP) += tlb.o obj-$(CONFIG_X86_32) += pgtable_32.o iomap_32.o
arch/x86/mm/tlb.c +116 -0
131 lines not on this page · raw message
include/linux/cpu.h +0 -18
@@ -59,25 +59,7 @@ struct notifier_block;* CPU notifier priorities. */ enum { -/* -* SCHED_ACTIVE marks a cpu which is coming up active during -* CPU_ONLINE and CPU_DOWN_FAILED and must be the first -* notifier. CPUSET_ACTIVE adjusts cpuset according to -* cpu_active mask right after SCHED_ACTIVE. During -* CPU_DOWN_PREPARE, SCHED_INACTIVE and CPUSET_INACTIVE are -* ordered in the similar way. -* -* This ordering guarantees consistent cpu_active mask and -* migration behavior to all cpu notifiers. -*/ -CPU_PRI_SCHED_ACTIVE =INT_MAX , -CPU_PRI_CPUSET_ACTIVE =INT_MAX -1 , -CPU_PRI_SCHED_INACTIVE =INT_MIN +1 , -CPU_PRI_CPUSET_INACTIVE =INT_MIN , - -/* migration should happen before other stuff but after perf */ CPU_PRI_PERF =20 , -CPU_PRI_MIGRATION =10 ,/* bring up workqueues before normal notifiers and down after */ CPU_PRI_WORKQUEUE_UP =5 ,
include/linux/cpuhotplug.h +2 -0
@@ -8,6 +8,7 @@ enum cpuhp_state {CPUHP_BRINGUP_CPU ,CPUHP_AP_IDLE_DEAD ,CPUHP_AP_OFFLINE , +CPUHP_AP_SCHED_STARTING ,CPUHP_AP_NOTIFY_STARTING ,CPUHP_AP_ONLINE , CPUHP_TEARDOWN_CPU,
@@ -16,6 +17,7 @@ enum cpuhp_state {CPUHP_AP_NOTIFY_ONLINE ,CPUHP_AP_ONLINE_DYN ,CPUHP_AP_ONLINE_DYN_END =CPUHP_AP_ONLINE_DYN +30 , +CPUHP_AP_ACTIVE , CPUHP_ONLINE, };
include/linux/cpumask.h +2 -4
@@ -743,12 +743,10 @@ set_cpu_present(unsigned int cpu, bool present)static inline void set_cpu_online (unsigned int cpu,bool online) { -if (online) { +if (online)cpumask_set_cpu (cpu, &__cpu_online_mask); -cpumask_set_cpu (cpu, &__cpu_active_mask); - }else { +else cpumask_clear_cpu (cpu, &__cpu_online_mask); - } } static inline void
include/linux/lockdep.h +17 -6
@@ -356,8 +356,13 @@ extern void lockdep_set_current_reclaim_state(gfp_t gfp_mask);extern void lockdep_clear_current_reclaim_state (void );extern void lockdep_trace_alloc (gfp_t mask); -extern void lock_pin_lock (struct lockdep_map *lock); -extern void lock_unpin_lock (struct lockdep_map *lock); +struct pin_cookie {unsigned int val; }; + +#define NIL_COOKIE (struct pin_cookie){ .val = 0U, } + +extern struct pin_cookie lock_pin_lock (struct lockdep_map *lock); +extern void lock_repin_lock (struct lockdep_map *lock,struct pin_cookie ); +extern void lock_unpin_lock (struct lockdep_map *lock,struct pin_cookie );# define INIT_LOCKDEP .lockdep_recursion = 0, .lockdep_reclaim_gfp = 0,
@@ -373,8 +378,9 @@ extern void lock_unpin_lock(struct lockdep_map *lock);#define lockdep_recursing (tsk) ((tsk)->lockdep_recursion) -#define lockdep_pin_lock (l) lock_pin_lock(&(l)->dep_map) -#define lockdep_unpin_lock (l) lock_unpin_lock(&(l)->dep_map) +#define lockdep_pin_lock (l) lock_pin_lock(&(l)->dep_map) +#define lockdep_repin_lock (l,c) lock_repin_lock(&(l)->dep_map, (c)) +#define lockdep_unpin_lock (l,c) lock_unpin_lock(&(l)->dep_map, (c))#else /* !CONFIG_LOCKDEP */
@@ -427,8 +433,13 @@ struct lock_class_key { };#define lockdep_recursing (tsk) (0) -#define lockdep_pin_lock (l) do { (void)(l); } while (0) -#define lockdep_unpin_lock (l) do { (void)(l); } while (0) +struct pin_cookie { }; + +#define NIL_COOKIE (struct pin_cookie){ } + +#define lockdep_pin_lock (l) ({ struct pin_cookie cookie; cookie; }) +#define lockdep_repin_lock (l, c) do { (void)(l); (void)(c); } while (0) +#define lockdep_unpin_lock (l, c) do { (void)(l); (void)(c); } while (0)#endif /* !LOCKDEP */
include/linux/mmu_context.h +7 -0
@@ -1,9 +1,16 @@#ifndef _LINUX_MMU_CONTEXT_H#define _LINUX_MMU_CONTEXT_H +#include <asm/mmu_context.h> +struct mm_struct ;void use_mm (struct mm_struct *mm);void unuse_mm (struct mm_struct *mm); +/* Architectures that care about IRQ state in switch_mm can override this. */ +#ifndef switch_mm_irqs_off +# define switch_mm_irqs_off switch_mm +#endif +#endif
include/linux/sched.h +108 -16
176 lines not on this page · raw message
kernel/cpu.c +15 -17
@@ -703,21 +703,6 @@ static int takedown_cpu(unsigned int cpu)struct cpuhp_cpu_state *st =per_cpu_ptr (&cpuhp_state, cpu);int err; -/* -* By now we've cleared cpu_active_mask, wait for all preempt-disabled -* and RCU users of this state to go away such that all new such users -* will observe it. -* -* For CONFIG_PREEMPT we have preemptible RCU and its sync_rcu() might -* not imply sync_sched(), so wait for both. -* -* Do sync before park smpboot threads to take care the rcu boost case. -*/ -if (IS_ENABLED (CONFIG_PREEMPT )) -synchronize_rcu_mult (call_rcu, call_rcu_sched); -else -synchronize_rcu (); -/* Park the smpboot threads */ kthread_park (per_cpu_ptr (&cpuhp_state, cpu)->thread);smpboot_park_threads (cpu);
@@ -923,8 +908,6 @@ void cpuhp_online_idle(enum cpuhp_state state) st->state =CPUHP_AP_ONLINE_IDLE ; -/* The cpu is marked online, set it active now */ -set_cpu_active (cpu, true);/* Unpark the stopper thread and the hotplug thread of this cpu */ stop_machine_unpark (cpu);kthread_unpark (st->thread);
@@ -1236,6 +1219,12 @@ static struct cpuhp_step cpuhp_ap_states[] = { .name = "ap:offline", .cant_stop = true, }, +/* First state is scheduler control. Interrupts are disabled */ + [CPUHP_AP_SCHED_STARTING] = { + .name = "sched:starting", + .startup = sched_cpu_starting, + .teardown = sched_cpu_dying, + },/* * Low level startup/teardown notifiers. Run with interrupts * disabled. Will be removed once the notifiers are converted to
@@ -1274,6 +1263,15 @@ static struct cpuhp_step cpuhp_ap_states[] = {* The dynamically registered state space is here */ +#ifdef CONFIG_SMP + /* Last state is scheduler control setting the cpu active */ + [CPUHP_AP_ACTIVE] = { + .name = "sched:active", + .startup = sched_cpu_activate, + .teardown = sched_cpu_deactivate, + }, +#endif + /* CPU is fully up and running. */ [CPUHP_ONLINE] = { .name = "online",
kernel/locking/lockdep.c +62 -9
127 lines not on this page · raw message
kernel/sched/clock.c +1 -47
68 lines not on this page · raw message
kernel/sched/core.c +417 -332
1,448 lines not on this page · raw message
kernel/sched/cpuacct.c +116 -31
264 lines not on this page · raw message
kernel/sched/cpudeadline.c +2 -2
@@ -103,10 +103,10 @@ int cpudl_find(struct cpudl *cp, struct task_struct *p,const struct sched_dl_entity *dl_se = &p->dl;if (later_mask && -cpumask_and (later_mask, cp->free_cpus, &p->cpus_allowed)) { +cpumask_and (later_mask, cp->free_cpus,tsk_cpus_allowed (p))) { best_cpu =cpumask_any (later_mask); goto out; - }else if (cpumask_test_cpu (cpudl_maximum (cp), &p->cpus_allowed) && + }else if (cpumask_test_cpu (cpudl_maximum (cp),tsk_cpus_allowed (p)) &&dl_time_before (dl_se->deadline, cp->elements[0 ].dl)) { best_cpu =cpudl_maximum (cp);if (later_mask)
kernel/sched/cpupri.c +2 -2
@@ -103,11 +103,11 @@ int cpupri_find(struct cpupri *cp, struct task_struct *p,if (skip)continue ; -if (cpumask_any_and (&p->cpus_allowed, vec->mask) >= nr_cpu_ids) +if (cpumask_any_and (tsk_cpus_allowed (p), vec->mask) >= nr_cpu_ids)continue ;if (lowest_mask) { -cpumask_and (lowest_mask, &p->cpus_allowed, vec->mask); +cpumask_and (lowest_mask,tsk_cpus_allowed (p), vec->mask);/* * We have to ensure that we have at least one bit
kernel/sched/deadline.c +28 -27
179 lines not on this page · raw message
kernel/sched/debug.c +5 -5
@@ -626,15 +626,16 @@ do { \#undef P#undef PN -#ifdef CONFIG_SCHEDSTATS -#define P (n) SEQ_printf(m, " .%-30s: %d\n", #n, rq->n); -#define P64 (n) SEQ_printf(m, " .%-30s: %Ld\n", #n, rq->n); -#ifdef CONFIG_SMP +#define P64 (n) SEQ_printf(m, " .%-30s: %Ld\n", #n, rq->n);P64 (avg_idle);P64 (max_idle_balance_cost); +#undef P64#endif +#ifdef CONFIG_SCHEDSTATS +#define P (n) SEQ_printf(m, " .%-30s: %d\n", #n, rq->n); +if (schedstat_enabled ()) {P (yld_count);P (sched_count);
@@ -644,7 +645,6 @@ do { \ }#undef P -#undef P64#endif spin_lock_irqsave (&sched_debug_lock, flags);print_cfs_stats (m, cpu);
kernel/sched/fair.c +328 -185
204 lines not on this page · raw message
kernel/sched/sched.h +50 -90
140 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.