scheduler changes for v4.8
Subsystems (3)
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: 748c7201e622d1c24abb4f85072d2e74d12f295f sched/core: Panic on scheduling while atomic bugs if kernel.panic_on_warn is set
- Introduce and use task_rcu_dereference()/try_get_task_struct() to fix and generalize task_struct handling. (Oleg Nesterov)
- Do various per entity load tracking (PELT) fixes and optimizations (Peter Zijlstra)
- cputime virt-steal time accounting enhancements/fixes (Wanpeng Li)
- Introduce consolidated cputime output file cpuacct.usage_all and related refactorings (Zhao Lei)
- ... plus misc fixes and enhancements
Thanks,
Ingo
------------------>
Daniel Bristot de Oliveira (1):
sched/core: Panic on scheduling while atomic bugs if kernel.panic_on_warn is set
Gaurav Jindal (Gaurav Jindal) (1):
sched/idle: Optimize the generic idle loop
Josh Poimboeuf (1):
sched/debug: Always show 'nr_migrations'
Oleg Nesterov (2):
sched/api: Introduce task_rcu_dereference() and try_get_task_struct() sched/fair: Use task_rcu_dereference()
Peter Zijlstra (6):
sched/fair: Fix and optimize the fork() path sched/fair: Fix PELT integrity for new groups sched/fair: Fix PELT integrity for new tasks sched/fair: Apply more PELT fixes sched/fair: Reorder cgroup creation code sched/fair: Rework throttle_count sync
Vincent Guittot (1):
sched/cgroup: Fix cpu_cgroup_fork() handling
Wanpeng Li (3):
KVM: Fix steal clock warp during guest CPU hotplug sched/cputime: Fix prev steal time accouting during CPU hotplug sched/cputime: Add steal time support to full dynticks CPU time accounting
Xunlei Pang (1):
sched/fair: Fix the wrong throttled clock time for cfs_rq_clock_task()
Zev Weiss (1):
sched/core: Fix sched_getaffinity() return value kerneldoc comment
Zhao Lei (3):
sched/cpuacct: Merge cpuacct_usage_index and cpuacct_stat_index enums sched/cpuacct: Use loop to consolidate code in cpuacct_stats_show() sched/cpuacct: Introduce cpuacct.usage_all to show all CPU stats together
arch/x86/kernel/kvm.c | 2 - include/linux/sched.h | 8 +- kernel/exit.c | 76 +++++++++++++++ kernel/sched/core.c | 114 +++++++++++++++------- kernel/sched/cpuacct.c | 114 ++++++++++++++-------- kernel/sched/cputime.c | 16 ++-- kernel/sched/debug.c | 2 +- kernel/sched/fair.c | 251 ++++++++++++++++++++++++++++++++----------------- kernel/sched/idle.c | 4 +- kernel/sched/sched.h | 21 ++--- 10 files changed, 418 insertions(+), 190 deletions(-)
arch/x86/kernel/kvm.c +0 -2
@@ -301,8 +301,6 @@ static void kvm_register_steal_time(void)if (!has_steal_clock)return ; -memset (st,0 ,sizeof (*st)); -wrmsrl (MSR_KVM_STEAL_TIME , (slow_virt_to_phys (st) |KVM_MSR_ENABLED ));pr_info ("kvm-stealtime: cpu %d, msr %llx\n" , cpu, (unsigned long long )slow_virt_to_phys (st));
include/linux/sched.h +6 -2
@@ -219,9 +219,10 @@ extern void proc_sched_set_task(struct task_struct *p);#define TASK_WAKING 256#define TASK_PARKED 512#define TASK_NOLOAD 1024 -#define TASK_STATE_MAX 2048 +#define TASK_NEW 2048 +#define TASK_STATE_MAX 4096 -#define TASK_STATE_TO_CHAR_STR "RSDTtXZxKWPN" +#define TASK_STATE_TO_CHAR_STR "RSDTtXZxKWPNn"extern char ___assert_task_state[1 -2 *!!(sizeof (TASK_STATE_TO_CHAR_STR )-1 !=ilog2 (TASK_STATE_MAX )+1 )];
@@ -2139,6 +2140,9 @@ static inline void put_task_struct(struct task_struct *t)__put_task_struct (t); } +struct task_struct *task_rcu_dereference (struct task_struct **ptask); +struct task_struct *try_get_task_struct (struct task_struct **ptask); +#ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN extern void task_cputime (struct task_struct *t,cputime_t *utime,cputime_t *stime);
kernel/exit.c +76 -0
82 lines not on this page · raw message
kernel/sched/core.c +81 -33
210 lines not on this page · raw message
kernel/sched/cpuacct.c +73 -41
219 lines not on this page · raw message
kernel/sched/cputime.c +9 -7
@@ -257,7 +257,7 @@ void account_idle_time(cputime_t cputime) cpustat[CPUTIME_IDLE ] += (__force u64 ) cputime; } -static __always_inline bool steal_account_process_tick(void) +static __always_inline unsigned long steal_account_process_tick (unsigned long max_jiffies) {#ifdef CONFIG_PARAVIRT if (static_key_false (¶virt_steal_enabled)) {
@@ -272,14 +272,14 @@ static __always_inline bool steal_account_process_tick(void)* time in jiffies. Lets cast the result to jiffies * granularity and account the rest on the next rounds. */ - steal_jiffies =nsecs_to_jiffies (steal); + steal_jiffies =min (nsecs_to_jiffies (steal), max_jiffies);this_rq ()->prev_steal_time +=jiffies_to_nsecs (steal_jiffies);account_steal_time (jiffies_to_cputime (steal_jiffies)); return steal_jiffies; }#endif -return false; +return 0 ; }/*
@@ -346,7 +346,7 @@ static void irqtime_account_process_tick(struct task_struct *p, int user_tick,u64 cputime = (__force u64 ) cputime_one_jiffy;u64 *cpustat = kcpustat_this_cpu->cpustat; -if (steal_account_process_tick ()) +if (steal_account_process_tick (ULONG_MAX ))return ; cputime *= ticks;
@@ -477,7 +477,7 @@ void account_process_tick(struct task_struct *p, int user_tick)return ; } -if (steal_account_process_tick ()) +if (steal_account_process_tick (ULONG_MAX ))return ;if (user_tick)
@@ -681,12 +681,14 @@ static cputime_t vtime_delta(struct task_struct *tsk)static cputime_t get_vtime_delta (struct task_struct *tsk) {unsigned long now =READ_ONCE (jiffies); -unsigned long delta = now - tsk->vtime_snap; +unsigned long delta_jiffies, steal_jiffies; + delta_jiffies = now - tsk->vtime_snap; + steal_jiffies =steal_account_process_tick (delta_jiffies);WARN_ON_ONCE (tsk->vtime_snap_whence ==VTIME_INACTIVE ); tsk->vtime_snap = now; -return jiffies_to_cputime (delta); +return jiffies_to_cputime (delta_jiffies - steal_jiffies); }static void __vtime_account_system (struct task_struct *tsk)
kernel/sched/debug.c +1 -1
@@ -879,9 +879,9 @@ void proc_sched_show_task(struct task_struct *p, struct seq_file *m) nr_switches = p->nvcsw + p->nivcsw; -#ifdef CONFIG_SCHEDSTATS P (se.nr_migrations); +#ifdef CONFIG_SCHEDSTATS if (schedstat_enabled ()) {u64 avg_atom, avg_per_cpu;
kernel/sched/fair.c +163 -88
472 lines not on this page · raw message
kernel/sched/idle.c +3 -1
@@ -201,6 +201,8 @@ static void cpuidle_idle_call(void)*/ static void cpu_idle_loop (void ) { +int cpu =smp_processor_id (); +while (1 ) {/* * If the arch has a polling bit, we maintain an invariant:
@@ -219,7 +221,7 @@ static void cpu_idle_loop(void)check_pgt_cache ();rmb (); -if (cpu_is_offline (smp_processor_id ())) { +if (cpu_is_offline (cpu)) {cpuhp_report_idle_dead ();arch_cpu_idle_dead (); }
kernel/sched/sched.h +6 -15
@@ -321,6 +321,7 @@ extern int tg_nop(struct task_group *tg, void *data);extern void free_fair_sched_group (struct task_group *tg);extern int alloc_fair_sched_group (struct task_group *tg,struct task_group *parent); +extern void online_fair_sched_group (struct task_group *tg);extern void unregister_fair_sched_group (struct task_group *tg); extern void init_tg_cfs_entry(struct task_group *tg, struct cfs_rq *cfs_rq, struct sched_entity *se, int cpu,
@@ -437,7 +438,7 @@ struct cfs_rq {u64 throttled_clock, throttled_clock_task;u64 throttled_clock_task_time; -int throttled, throttle_count, throttle_uptodate; +int throttled, throttle_count;struct list_head throttled_list;#endif /* CONFIG_CFS_BANDWIDTH */ #endif /* CONFIG_FAIR_GROUP_SCHED */
@@ -1246,8 +1247,11 @@ struct sched_class {void (*update_curr) (struct rq *rq); +#define TASK_SET_GROUP 0 +#define TASK_MOVE_GROUP 1 +#ifdef CONFIG_FAIR_GROUP_SCHED -void (*task_move_group) (struct task_struct *p); +void (*task_change_group) (struct task_struct *p,int type);#endif };
@@ -1809,16 +1813,3 @@ static inline void cpufreq_trigger_update(u64 time) {}#else /* arch_scale_freq_capacity */ #define arch_scale_freq_invariant () (false)#endif - -static inline void account_reset_rq (struct rq *rq) -{ -#ifdef CONFIG_IRQ_TIME_ACCOUNTING - rq->prev_irq_time =0 ; -#endif -#ifdef CONFIG_PARAVIRT - rq->prev_steal_time =0 ; -#endif -#ifdef CONFIG_PARAVIRT_TIME_ACCOUNTING - rq->prev_steal_time_rq =0 ; -#endif -}