sched: Remove per rq load array
Subsystems (2)
Dietmar Eggemann
reviewercover sched: Remove per rq load array
Since commit fdf5f315d5cf "sched/fair: Disable LB_BIAS by default" (v4.20) the scheduler feature LB_BIAS is disabled, i.e. the scheduler has been only using rq->cpu_load[0] for the cpu load values since then.
Tests back then (result are listed in the header of the patch mentioned above) haven't shown any regressions and people haven't complained about any related problems in the meantime (v4.20 - v5.1).
The following patches remove all the functionality which is not needed anymore:
(1) Per rq load array update code
(2) CFS' source_load() and target_load() used for conservative load balancing which can be directly replaced by weighted_cpuload()
(3) Per rq load array (rq->cpu_load[])
(4) Sched domain per rq load indexes (sd->*_idx) since there is no other user for it
(5) sum_weighted_load of sched group load balance stats because it's now identical with the actual sched group load
Dietmar Eggemann (7):
sched: Remove rq->cpu_load[] update code sched/fair: Replace source_load() & target_load() w/
weighted_cpuload()
sched/debug: Remove sd->*_idx range on sysctl
sched: Remove rq->cpu_load[]
sched: Remove sd->*_idx
sched/fair: Remove sgs->sum_weighted_load sched/fair: Rename weighted_cpuload() to cpu_load()
include/linux/sched/nohz.h | 8 - include/linux/sched/topology.h | 5 - kernel/sched/core.c | 7 +- kernel/sched/debug.c | 41 +--- kernel/sched/fair.c | 385 ++------------------------------- kernel/sched/features.h | 1 - kernel/sched/sched.h | 8 - kernel/sched/topology.c | 10 - kernel/time/tick-sched.c | 2 - 9 files changed, 33 insertions(+), 434 deletions(-)
Signature · 1 line
2.17.1
Dietmar Eggemann
reviewerPATCH 1/7 sched: Remove rq->cpu_load[] update code
With LB_BIAS disabled, there is no need to update the rq->cpu_load[idx] any more.
--- include/linux/sched/nohz.h | 8 -- kernel/sched/core.c | 1 - kernel/sched/fair.c | 255 ------------------------------------- kernel/sched/sched.h | 6 - kernel/time/tick-sched.c | 2 - 5 files changed, 272 deletions(-)
include/linux/sched/nohz.h +0 -8
@@ -6,14 +6,6 @@* This is the interface between the scheduler and nohz/dynticks: */ -#if defined(CONFIG_SMP ) && defined(CONFIG_NO_HZ_COMMON ) -extern void cpu_load_update_nohz_start (void ); -extern void cpu_load_update_nohz_stop (void ); -#else -static inline void cpu_load_update_nohz_start (void ) { } -static inline void cpu_load_update_nohz_stop (void ) { } -#endif -#if defined(CONFIG_SMP ) && defined(CONFIG_NO_HZ_COMMON )extern void nohz_balance_enter_idle (int cpu);extern int get_nohz_timer_target (void );
kernel/sched/core.c +0 -1
@@ -3032,7 +3032,6 @@ void scheduler_tick(void)update_rq_clock (rq); curr->sched_class->task_tick (rq, curr,0 ); -cpu_load_update_active (rq);calc_global_load_tick (rq);psi_task_tick (rq);
kernel/sched/fair.c +0 -255
279 lines not on this page · raw message
kernel/sched/sched.h +0 -6
@@ -96,12 +96,6 @@ extern atomic_long_t calc_load_tasks;extern void calc_global_load_tick (struct rq *this_rq);extern long calc_load_fold_active (struct rq *this_rq,long adjust); -#ifdef CONFIG_SMP -extern void cpu_load_update_active (struct rq *this_rq); -#else -static inline void cpu_load_update_active (struct rq *this_rq) { } -#endif -/* * Helpers for converting nanosecond timing to jiffy resolution */
kernel/time/tick-sched.c +0 -2
@@ -782,7 +782,6 @@ static void tick_nohz_stop_tick(struct tick_sched *ts, int cpu)*/ if (!ts->tick_stopped) {calc_load_nohz_start (); -cpu_load_update_nohz_start ();quiet_vmstat (); ts->last_tick =hrtimer_get_expires (&ts->sched_timer);
@@ -829,7 +828,6 @@ static void tick_nohz_restart_sched_tick(struct tick_sched *ts, ktime_t now) {/* Update jiffies first */ tick_do_update_jiffies64 (now); -cpu_load_update_nohz_stop ();/* * Clear the timer idle flag, so we avoid IPIs on remote queueing and
Signature · 1 line
2.17.1
Re: [PATCH 1/7] sched: Remove rq->cpu_load[] update code
Quoted 5 lines · Dietmar Eggemann
With
LB_BIASdisabled, there is no need to update the rq-Quoted 1 line
cpu_load[idx]
any more.
Signed-off-by Dietmar Eggemann <[email protected]>
tip-bot for Dietmar Eggemann
merge bot[tip:sched/core] sched/fair: Remove the rq->cpu_load[] update code
In reply to Dietmar Eggemannsched/fair: Remove the rq->cpu_load[] update code
Commit-ID: 5e83eafbfd3b351537c0d74467fc43e8a88f4ae4 Gitweb: https://git.kernel.org/tip/5e83eafbfd3b351537c0d74467fc43e8a88f4ae4 Author: Dietmar Eggemann <[email protected]> AuthorDate: Mon, 27 May 2019 07:21:10 +0100 Committer: Ingo Molnar <[email protected]> CommitDate: Mon, 3 Jun 2019 11:49:38 +0200
sched/fair: Remove the rq->cpu_load[] update code
With LB_BIAS disabled, there is no need to update the rq->cpu_load[idx] any more.
--- include/linux/sched/nohz.h | 8 -- kernel/sched/core.c | 1 - kernel/sched/fair.c | 255 --------------------------------------------- kernel/sched/sched.h | 6 -- kernel/time/tick-sched.c | 2 - 5 files changed, 272 deletions(-)
include/linux/sched/nohz.h +0 -8
@@ -6,14 +6,6 @@* This is the interface between the scheduler and nohz/dynticks: */ -#if defined(CONFIG_SMP ) && defined(CONFIG_NO_HZ_COMMON ) -extern void cpu_load_update_nohz_start (void ); -extern void cpu_load_update_nohz_stop (void ); -#else -static inline void cpu_load_update_nohz_start (void ) { } -static inline void cpu_load_update_nohz_stop (void ) { } -#endif -#if defined(CONFIG_SMP ) && defined(CONFIG_NO_HZ_COMMON )extern void nohz_balance_enter_idle (int cpu);extern int get_nohz_timer_target (void );
kernel/sched/core.c +0 -1
@@ -3033,7 +3033,6 @@ void scheduler_tick(void)update_rq_clock (rq); curr->sched_class->task_tick (rq, curr,0 ); -cpu_load_update_active (rq);calc_global_load_tick (rq);psi_task_tick (rq);
kernel/sched/fair.c +0 -255
279 lines not on this page · raw message
kernel/sched/sched.h +0 -6
@@ -96,12 +96,6 @@ extern atomic_long_t calc_load_tasks;extern void calc_global_load_tick (struct rq *this_rq);extern long calc_load_fold_active (struct rq *this_rq,long adjust); -#ifdef CONFIG_SMP -extern void cpu_load_update_active (struct rq *this_rq); -#else -static inline void cpu_load_update_active (struct rq *this_rq) { } -#endif -/* * Helpers for converting nanosecond timing to jiffy resolution */
kernel/time/tick-sched.c +0 -2
@@ -782,7 +782,6 @@ static void tick_nohz_stop_tick(struct tick_sched *ts, int cpu)*/ if (!ts->tick_stopped) {calc_load_nohz_start (); -cpu_load_update_nohz_start ();quiet_vmstat (); ts->last_tick =hrtimer_get_expires (&ts->sched_timer);
@@ -829,7 +828,6 @@ static void tick_nohz_restart_sched_tick(struct tick_sched *ts, ktime_t now) {/* Update jiffies first */ tick_do_update_jiffies64 (now); -cpu_load_update_nohz_stop ();/* * Clear the timer idle flag, so we avoid IPIs on remote queueing and
Dietmar Eggemann
reviewerPATCH 2/7 sched/fair: Replace source_load() & target_load() w/ weighted_cpuload()
In reply to Dietmar EggemannWith LB_BIAS disabled, source_load() & target_load() return weighted_cpuload(). Replace both with calls to weighted_cpuload().
The function to obtain the load index (sd->*_idx) for an sd, get_sd_load_idx(), can be removed as well.
Finally, get rid of the sched feature LB_BIAS.
--- kernel/sched/fair.c | 90 ++--------------------------------------- kernel/sched/features.h | 1 - 2 files changed, 4 insertions(+), 87 deletions(-)
kernel/sched/fair.c +4 -86
@@ -1467,8 +1467,6 @@ bool should_numa_migrate_memory(struct task_struct *p, struct page * page, }static unsigned long weighted_cpuload (struct rq *rq); -static unsigned long source_load (int cpu,int type); -static unsigned long target_load (int cpu,int type);/* Cached statistics for all CPUs within a node */ struct numa_stats {
@@ -5336,45 +5334,11 @@ static struct {#endif /* CONFIG_NO_HZ_COMMON */ -/* Used instead of source_load when we know the type == 0 */ static unsigned long weighted_cpuload (struct rq *rq) {return cfs_rq_runnable_load_avg (&rq->cfs); } -/* -* Return a low guess at the load of a migration-source CPU weighted -* according to the scheduling class and "nice" value. -* -* We want to under-estimate the load of migration sources, to -* balance conservatively. -*/ -static unsigned long source_load (int cpu,int type) -{ -struct rq *rq =cpu_rq (cpu); -unsigned long total =weighted_cpuload (rq); - -if (type ==0 || !sched_feat (LB_BIAS )) -return total; - -return min (rq->cpu_load[type-1 ], total); -} - -/* -* Return a high guess at the load of a migration-target CPU weighted -* according to the scheduling class and "nice" value. -*/ -static unsigned long target_load (int cpu,int type) -{ -struct rq *rq =cpu_rq (cpu); -unsigned long total =weighted_cpuload (rq); - -if (type ==0 || !sched_feat (LB_BIAS )) -return total; - -return max (rq->cpu_load[type-1 ], total); -} -static unsigned long capacity_of (int cpu) {return cpu_rq (cpu)->cpu_capacity;
@@ -5482,7 +5446,7 @@ wake_affine_weight(struct sched_domain *sd, struct task_struct *p,s64 this_eff_load, prev_eff_load;unsigned long task_load; - this_eff_load =target_load (this_cpu, sd->wake_idx); + this_eff_load =weighted_cpuload (cpu_rq (this_cpu));if (sync) {unsigned long current_load =task_h_load (current);
@@ -5500,7 +5464,7 @@ wake_affine_weight(struct sched_domain *sd, struct task_struct *p, this_eff_load *=100 ; this_eff_load *=capacity_of (prev_cpu); - prev_eff_load =source_load (prev_cpu, sd->wake_idx); + prev_eff_load =weighted_cpuload (cpu_rq (this_cpu)); prev_eff_load -= task_load;if (sched_feat (WA_BIAS )) prev_eff_load *=100 + (sd->imbalance_pct -100 ) /2 ;
@@ -5561,14 +5525,10 @@ find_idlest_group(struct sched_domain *sd, struct task_struct *p,unsigned long this_runnable_load =ULONG_MAX ;unsigned long min_avg_load =ULONG_MAX , this_avg_load =ULONG_MAX ;unsigned long most_spare =0 , this_spare =0 ; -int load_idx = sd->forkexec_idx;int imbalance_scale =100 + (sd->imbalance_pct-100 )/2 ;unsigned long imbalance =scale_load_down (NICE_0_LOAD ) * (sd->imbalance_pct-100 ) /100 ; -if (sd_flag &SD_BALANCE_WAKE ) - load_idx = sd->wake_idx; - do { unsigned long load, avg_load, runnable_load; unsigned long spare_cap, max_spare_cap;
@@ -5592,12 +5552,7 @@ find_idlest_group(struct sched_domain *sd, struct task_struct *p, max_spare_cap =0 ;for_each_cpu (i,sched_group_span (group)) { -/* Bias balancing toward CPUs of our domain */ -if (local_group) - load =source_load (i, load_idx); -else - load =target_load (i, load_idx); - + load =weighted_cpuload (cpu_rq (i)); runnable_load += load; avg_load +=cfs_rq_load_avg (&cpu_rq (i)->cfs);
@@ -7679,34 +7634,6 @@ static inline void init_sd_lb_stats(struct sd_lb_stats *sds) }; } -/** -* get_sd_load_idx - Obtain the load index for a given sched domain. -* @sd: The sched_domain whose load_idx is to be obtained. -* @idle: The idle status of the CPU for whose sd load_idx is obtained. -* -* Return: The load index. -*/ -static inline int get_sd_load_idx (struct sched_domain *sd, -enum cpu_idle_type idle) -{ -int load_idx; - -switch (idle) { -case CPU_NOT_IDLE : - load_idx = sd->busy_idx; -break ; - -case CPU_NEWLY_IDLE : - load_idx = sd->newidle_idx; -break ; -default : - load_idx = sd->idle_idx; -break ; - } - -return load_idx; -} -static unsigned long scale_rt_capacity (struct sched_domain *sd,int cpu) {struct rq *rq =cpu_rq (cpu);
@@ -7995,9 +7922,6 @@ static inline void update_sg_lb_stats(struct lb_env *env,struct sg_lb_stats *sgs, int *sg_status) { - int local_group = cpumask_test_cpu(env->dst_cpu, sched_group_span(group)); -int load_idx =get_sd_load_idx (env->sd, env->idle); -unsigned long load; int i, nr_running;memset (sgs,0 ,sizeof (*sgs));
@@ -8008,13 +7932,7 @@ static inline void update_sg_lb_stats(struct lb_env *env,if ((env->flags &LBF_NOHZ_STATS ) &&update_nohz_stats (rq, false)) env->flags |=LBF_NOHZ_AGAIN ; -/* Bias balancing toward CPUs of our domain: */ -if (local_group) - load =target_load (i, load_idx); -else - load =source_load (i, load_idx); - - sgs->group_load += load; + sgs->group_load +=weighted_cpuload (rq); sgs->group_util +=cpu_util (i); sgs->sum_nr_running += rq->cfs.h_nr_running;
kernel/sched/features.h +0 -1
@@ -39,7 +39,6 @@ SCHED_FEAT(WAKEUP_PREEMPTION, true) SCHED_FEAT(HRTICK, false)SCHED_FEAT (DOUBLE_TICK , false) -SCHED_FEAT (LB_BIAS , false)/* * Decrement CPU capacity based on time not spent running tasks
Signature · 1 line
2.17.1
Re: [PATCH 2/7] sched/fair: Replace source_load() & target_load() w/ weighted_cpuload()
Quoted 9 lines · Dietmar Eggemann
With
LB_BIASdisabled,source_load()&target_load()returnweighted_cpuload(). Replace both with calls toweighted_cpuload().The function to obtain the load index (sd->*_idx) for an sd,
get_sd_load_idx(), can be removed as well.Finally, get rid of the sched feature
LB_BIAS.Signed-off-by Dietmar Eggemann <[email protected]>
Dietmar Eggemann
reviewerRe: [PATCH 2/7] sched/fair: Replace source_load() & target_load() w/ weighted_cpuload()
In reply to Dietmar EggemannQuoted 2 lines · Hillf Danton
On Mon, 27 May 2019 07:21:11 +0100 Dietmar Eggemann wrote:
[...]
Quoted 9 lines
kernel/sched/fair.c wake_affine_weight(struct sched_domain *sd, struct task_struct *p, · line 5467
Quoted 6 lines
kernel/sched/fair.c +1
-1@@ -5500,7 +5464,7 @@ wake_affine_weight(struct sched_domain *sd, struct task_struct *p, this_eff_load *=100 ; this_eff_load *=capacity_of (prev_cpu); - prev_eff_load =source_load (prev_cpu, sd->wake_idx); + prev_eff_load =weighted_cpuload (cpu_rq (this_cpu));
cpu_rq(prev_cpu)Seems we have no need to see this cpu's load more than once.
Thanks for catching this! Will fix it in v2.
Peter Zijlstra
maintainerRe: [PATCH 2/7] sched/fair: Replace source_load() & target_load() w/ weighted_cpuload()
Quoted 13 lines · Dietmar Eggemann
Quoted 2 lines · Hillf Danton
On Mon, 27 May 2019 07:21:11 +0100 Dietmar Eggemann wrote:
[...]
Quoted 7 lines
kernel/sched/fair.c wake_affine_weight(struct sched_domain *sd, struct task_struct *p, · line 5466
Quoted 5 lines
kernel/sched/fair.c +1
-1@@ -5500,7 +5464,7 @@ wake_affine_weight(struct sched_domain *sd, struct task_struct *p, this_eff_load *=100 ; this_eff_load *=capacity_of (prev_cpu); - prev_eff_load =source_load (prev_cpu, sd->wake_idx); + prev_eff_load =weighted_cpuload (cpu_rq (this_cpu));
cpu_rq(prev_cpu)
Quoted 3 lines
Quoted 1 line
Seems we have no need to see this cpu's load more than once.
Thanks for catching this! Will fix it in v2.
Fixed :-)
tip-bot for Dietmar Eggemann
merge bot[tip:sched/core] sched/fair: Replace source_load() & target_load() with weighted_cpuload()
In reply to Dietmar Eggemannsched/fair: Replace source_load() & target_load() with weighted_cpuload()
Commit-ID: 1c1b8a7b03ef50f80f5d0c871ee261c04a6c967e Gitweb: https://git.kernel.org/tip/1c1b8a7b03ef50f80f5d0c871ee261c04a6c967e Author: Dietmar Eggemann <[email protected]> AuthorDate: Mon, 27 May 2019 07:21:11 +0100 Committer: Ingo Molnar <[email protected]> CommitDate: Mon, 3 Jun 2019 11:49:39 +0200
sched/fair: Replace source_load() & target_load() with weighted_cpuload()
With LB_BIAS disabled, source_load() & target_load() return weighted_cpuload(). Replace both with calls to weighted_cpuload().
The function to obtain the load index (sd->*_idx) for an sd, get_sd_load_idx(), can be removed as well.
Finally, get rid of the sched feature LB_BIAS.
--- kernel/sched/fair.c | 90 +++---------------------------------------------- kernel/sched/features.h | 1 - 2 files changed, 4 insertions(+), 87 deletions(-)
kernel/sched/fair.c +4 -86
@@ -1467,8 +1467,6 @@ bool should_numa_migrate_memory(struct task_struct *p, struct page * page, }static unsigned long weighted_cpuload (struct rq *rq); -static unsigned long source_load (int cpu,int type); -static unsigned long target_load (int cpu,int type);/* Cached statistics for all CPUs within a node */ struct numa_stats {
@@ -5333,45 +5331,11 @@ static struct {#endif /* CONFIG_NO_HZ_COMMON */ -/* Used instead of source_load when we know the type == 0 */ static unsigned long weighted_cpuload (struct rq *rq) {return cfs_rq_runnable_load_avg (&rq->cfs); } -/* -* Return a low guess at the load of a migration-source CPU weighted -* according to the scheduling class and "nice" value. -* -* We want to under-estimate the load of migration sources, to -* balance conservatively. -*/ -static unsigned long source_load (int cpu,int type) -{ -struct rq *rq =cpu_rq (cpu); -unsigned long total =weighted_cpuload (rq); - -if (type ==0 || !sched_feat (LB_BIAS )) -return total; - -return min (rq->cpu_load[type-1 ], total); -} - -/* -* Return a high guess at the load of a migration-target CPU weighted -* according to the scheduling class and "nice" value. -*/ -static unsigned long target_load (int cpu,int type) -{ -struct rq *rq =cpu_rq (cpu); -unsigned long total =weighted_cpuload (rq); - -if (type ==0 || !sched_feat (LB_BIAS )) -return total; - -return max (rq->cpu_load[type-1 ], total); -} -static unsigned long capacity_of (int cpu) {return cpu_rq (cpu)->cpu_capacity;
@@ -5479,7 +5443,7 @@ wake_affine_weight(struct sched_domain *sd, struct task_struct *p,s64 this_eff_load, prev_eff_load;unsigned long task_load; - this_eff_load =target_load (this_cpu, sd->wake_idx); + this_eff_load =weighted_cpuload (cpu_rq (this_cpu));if (sync) {unsigned long current_load =task_h_load (current);
@@ -5497,7 +5461,7 @@ wake_affine_weight(struct sched_domain *sd, struct task_struct *p, this_eff_load *=100 ; this_eff_load *=capacity_of (prev_cpu); - prev_eff_load =source_load (prev_cpu, sd->wake_idx); + prev_eff_load =weighted_cpuload (cpu_rq (prev_cpu)); prev_eff_load -= task_load;if (sched_feat (WA_BIAS )) prev_eff_load *=100 + (sd->imbalance_pct -100 ) /2 ;
@@ -5558,14 +5522,10 @@ find_idlest_group(struct sched_domain *sd, struct task_struct *p,unsigned long this_runnable_load =ULONG_MAX ;unsigned long min_avg_load =ULONG_MAX , this_avg_load =ULONG_MAX ;unsigned long most_spare =0 , this_spare =0 ; -int load_idx = sd->forkexec_idx;int imbalance_scale =100 + (sd->imbalance_pct-100 )/2 ;unsigned long imbalance =scale_load_down (NICE_0_LOAD ) * (sd->imbalance_pct-100 ) /100 ; -if (sd_flag &SD_BALANCE_WAKE ) - load_idx = sd->wake_idx; - do { unsigned long load, avg_load, runnable_load; unsigned long spare_cap, max_spare_cap;
@@ -5589,12 +5549,7 @@ find_idlest_group(struct sched_domain *sd, struct task_struct *p, max_spare_cap =0 ;for_each_cpu (i,sched_group_span (group)) { -/* Bias balancing toward CPUs of our domain */ -if (local_group) - load =source_load (i, load_idx); -else - load =target_load (i, load_idx); - + load =weighted_cpuload (cpu_rq (i)); runnable_load += load; avg_load +=cfs_rq_load_avg (&cpu_rq (i)->cfs);
@@ -7676,34 +7631,6 @@ static inline void init_sd_lb_stats(struct sd_lb_stats *sds) }; } -/** -* get_sd_load_idx - Obtain the load index for a given sched domain. -* @sd: The sched_domain whose load_idx is to be obtained. -* @idle: The idle status of the CPU for whose sd load_idx is obtained. -* -* Return: The load index. -*/ -static inline int get_sd_load_idx (struct sched_domain *sd, -enum cpu_idle_type idle) -{ -int load_idx; - -switch (idle) { -case CPU_NOT_IDLE : - load_idx = sd->busy_idx; -break ; - -case CPU_NEWLY_IDLE : - load_idx = sd->newidle_idx; -break ; -default : - load_idx = sd->idle_idx; -break ; - } - -return load_idx; -} -static unsigned long scale_rt_capacity (struct sched_domain *sd,int cpu) {struct rq *rq =cpu_rq (cpu);
@@ -7992,9 +7919,6 @@ static inline void update_sg_lb_stats(struct lb_env *env,struct sg_lb_stats *sgs, int *sg_status) { - int local_group = cpumask_test_cpu(env->dst_cpu, sched_group_span(group)); -int load_idx =get_sd_load_idx (env->sd, env->idle); -unsigned long load; int i, nr_running;memset (sgs,0 ,sizeof (*sgs));
@@ -8005,13 +7929,7 @@ static inline void update_sg_lb_stats(struct lb_env *env,if ((env->flags &LBF_NOHZ_STATS ) &&update_nohz_stats (rq, false)) env->flags |=LBF_NOHZ_AGAIN ; -/* Bias balancing toward CPUs of our domain: */ -if (local_group) - load =target_load (i, load_idx); -else - load =source_load (i, load_idx); - - sgs->group_load += load; + sgs->group_load +=weighted_cpuload (rq); sgs->group_util +=cpu_util (i); sgs->sum_nr_running += rq->cfs.h_nr_running;
kernel/sched/features.h +0 -1
@@ -39,7 +39,6 @@ SCHED_FEAT(WAKEUP_PREEMPTION, true) SCHED_FEAT(HRTICK, false)SCHED_FEAT (DOUBLE_TICK , false) -SCHED_FEAT (LB_BIAS , false)/* * Decrement CPU capacity based on time not spent running tasks
Dietmar Eggemann
reviewerPATCH 3/7 sched/debug: Remove sd->*_idx range on sysctl
In reply to Dietmar EggemannThis reverts commit 201c373e8e48 ("sched/debug: Limit sd->*_idx range on sysctl").
Load indexes (sd->*_idx) are no longer needed without rq->cpu_load[]. The range check for load indexes can be removed as well. Get rid of it before the rq->cpu_load[] since it uses CPU_LOAD_IDX_MAX.
At the same time, fix the following coding style issues detected by scripts/checkpatch.pl:
ERROR: space prohibited before that ','
ERROR: space prohibited before that close parenthesis ')'
--- kernel/sched/debug.c | 37 ++++++++++++++----------------------- 1 file changed, 14 insertions(+), 23 deletions(-)
kernel/sched/debug.c +14 -23
@@ -236,25 +236,16 @@ static void sd_free_ctl_entry(struct ctl_table **tablep) *tablep =NULL ; } -static int min_load_idx =0 ; -static int max_load_idx =CPU_LOAD_IDX_MAX -1 ; -static void set_table_entry (struct ctl_table *entry,const char *procname,void *data,int maxlen, -umode_t mode,proc_handler *proc_handler, -bool load_idx) +umode_t mode,proc_handler *proc_handler) { entry->procname = procname; entry->data = data; entry->maxlen = maxlen; entry->mode = mode; entry->proc_handler = proc_handler; - -if (load_idx) { - entry->extra1 = &min_load_idx; - entry->extra2 = &max_load_idx; - } } static struct ctl_table *
@@ -265,19 +256,19 @@ sd_alloc_ctl_domain_table(struct sched_domain *sd)if (table ==NULL )return NULL ; -set_table_entry (&table[0 ] ,"min_interval" , &sd->min_interval,sizeof (long ),0644 , proc_doulongvec_minmax, false); -set_table_entry (&table[1 ] ,"max_interval" , &sd->max_interval,sizeof (long ),0644 , proc_doulongvec_minmax, false); -set_table_entry (&table[2 ] ,"busy_idx" , &sd->busy_idx,sizeof (int ) ,0644 , proc_dointvec_minmax, true ); -set_table_entry (&table[3 ] ,"idle_idx" , &sd->idle_idx,sizeof (int ) ,0644 , proc_dointvec_minmax, true ); -set_table_entry (&table[4 ] ,"newidle_idx" , &sd->newidle_idx,sizeof (int ) ,0644 , proc_dointvec_minmax, true ); -set_table_entry (&table[5 ] ,"wake_idx" , &sd->wake_idx,sizeof (int ) ,0644 , proc_dointvec_minmax, true ); -set_table_entry (&table[6 ] ,"forkexec_idx" , &sd->forkexec_idx,sizeof (int ) ,0644 , proc_dointvec_minmax, true ); -set_table_entry (&table[7 ] ,"busy_factor" , &sd->busy_factor,sizeof (int ) ,0644 , proc_dointvec_minmax, false); -set_table_entry (&table[8 ] ,"imbalance_pct" , &sd->imbalance_pct,sizeof (int ) ,0644 , proc_dointvec_minmax, false); -set_table_entry (&table[9 ] ,"cache_nice_tries" , &sd->cache_nice_tries,sizeof (int ) ,0644 , proc_dointvec_minmax, false); -set_table_entry (&table[10 ],"flags" , &sd->flags,sizeof (int ) ,0644 , proc_dointvec_minmax, false); -set_table_entry (&table[11 ],"max_newidle_lb_cost" , &sd->max_newidle_lb_cost,sizeof (long ),0644 , proc_doulongvec_minmax, false); -set_table_entry (&table[12 ],"name" , sd->name,CORENAME_MAX_SIZE ,0444 , proc_dostring, false); +set_table_entry (&table[0 ],"min_interval" , &sd->min_interval,sizeof (long ),0644 , proc_doulongvec_minmax); +set_table_entry (&table[1 ],"max_interval" , &sd->max_interval,sizeof (long ),0644 , proc_doulongvec_minmax); +set_table_entry (&table[2 ],"busy_idx" , &sd->busy_idx,sizeof (int ),0644 , proc_dointvec_minmax); +set_table_entry (&table[3 ],"idle_idx" , &sd->idle_idx,sizeof (int ),0644 , proc_dointvec_minmax); +set_table_entry (&table[4 ],"newidle_idx" , &sd->newidle_idx,sizeof (int ),0644 , proc_dointvec_minmax); +set_table_entry (&table[5 ],"wake_idx" , &sd->wake_idx,sizeof (int ),0644 , proc_dointvec_minmax); +set_table_entry (&table[6 ],"forkexec_idx" , &sd->forkexec_idx,sizeof (int ),0644 , proc_dointvec_minmax); +set_table_entry (&table[7 ],"busy_factor" , &sd->busy_factor,sizeof (int ),0644 , proc_dointvec_minmax); +set_table_entry (&table[8 ],"imbalance_pct" , &sd->imbalance_pct,sizeof (int ),0644 , proc_dointvec_minmax); +set_table_entry (&table[9 ],"cache_nice_tries" , &sd->cache_nice_tries,sizeof (int ),0644 , proc_dointvec_minmax); +set_table_entry (&table[10 ],"flags" , &sd->flags,sizeof (int ),0644 , proc_dointvec_minmax); +set_table_entry (&table[11 ],"max_newidle_lb_cost" , &sd->max_newidle_lb_cost,sizeof (long ),0644 , proc_doulongvec_minmax); +set_table_entry (&table[12 ],"name" , sd->name,CORENAME_MAX_SIZE ,0444 , proc_dostring);/* &table[13] is terminator */ return table;
Signature · 1 line
2.17.1
Re: [PATCH 3/7] sched/debug: Remove sd->*_idx range on sysctl
Quoted 9 lines · Dietmar Eggemann
This reverts commit
201c373e8e48("sched/debug: Limit sd->*_idx range on
sysctl").Load indexes (sd->*_idx) are no longer needed without rq->cpu_load[]. The range check for load indexes can be removed as well. Get rid of it
before the rq->cpu_load[] since it usesCPU_LOAD_IDX_MAX.
Quoted 7 lines
At the same time, fix the following coding style issues detected by
scripts/checkpatch.pl:ERROR: space prohibited before that ','
ERROR: space prohibited before that close parenthesis ')'Signed-off-by Dietmar Eggemann <[email protected]>
Signature · 1 line
All Rights Reversed.
tip-bot for Dietmar Eggemann
merge bot[tip:sched/core] sched/debug: Remove sd->*_idx range on sysctl
In reply to Dietmar Eggemannsched/debug: Remove sd->*_idx range on sysctl
Commit-ID: 3d8d53554405952993bb0279ef3ebebc51740074 Gitweb: https://git.kernel.org/tip/3d8d53554405952993bb0279ef3ebebc51740074 Author: Dietmar Eggemann <[email protected]> AuthorDate: Mon, 27 May 2019 07:21:12 +0100 Committer: Ingo Molnar <[email protected]> CommitDate: Mon, 3 Jun 2019 11:49:39 +0200
sched/debug: Remove sd->*_idx range on sysctl
This reverts:
commit 201c373e8e48 ("sched/debug: Limit sd->*_idx range on sysctl")
Load indexes (sd->*_idx) are no longer needed without rq->cpu_load[]. The range check for load indexes can be removed as well. Get rid of it before the rq->cpu_load[] since it uses CPU_LOAD_IDX_MAX.
At the same time, fix the following coding style issues detected by scripts/checkpatch.pl:
ERROR: space prohibited before that ','
ERROR: space prohibited before that close parenthesis ')'
--- kernel/sched/debug.c | 37 ++++++++++++++----------------------- 1 file changed, 14 insertions(+), 23 deletions(-)
kernel/sched/debug.c +14 -23
@@ -236,25 +236,16 @@ static void sd_free_ctl_entry(struct ctl_table **tablep) *tablep =NULL ; } -static int min_load_idx =0 ; -static int max_load_idx =CPU_LOAD_IDX_MAX -1 ; -static void set_table_entry (struct ctl_table *entry,const char *procname,void *data,int maxlen, -umode_t mode,proc_handler *proc_handler, -bool load_idx) +umode_t mode,proc_handler *proc_handler) { entry->procname = procname; entry->data = data; entry->maxlen = maxlen; entry->mode = mode; entry->proc_handler = proc_handler; - -if (load_idx) { - entry->extra1 = &min_load_idx; - entry->extra2 = &max_load_idx; - } } static struct ctl_table *
@@ -265,19 +256,19 @@ sd_alloc_ctl_domain_table(struct sched_domain *sd)if (table ==NULL )return NULL ; -set_table_entry (&table[0 ] ,"min_interval" , &sd->min_interval,sizeof (long ),0644 , proc_doulongvec_minmax, false); -set_table_entry (&table[1 ] ,"max_interval" , &sd->max_interval,sizeof (long ),0644 , proc_doulongvec_minmax, false); -set_table_entry (&table[2 ] ,"busy_idx" , &sd->busy_idx,sizeof (int ) ,0644 , proc_dointvec_minmax, true ); -set_table_entry (&table[3 ] ,"idle_idx" , &sd->idle_idx,sizeof (int ) ,0644 , proc_dointvec_minmax, true ); -set_table_entry (&table[4 ] ,"newidle_idx" , &sd->newidle_idx,sizeof (int ) ,0644 , proc_dointvec_minmax, true ); -set_table_entry (&table[5 ] ,"wake_idx" , &sd->wake_idx,sizeof (int ) ,0644 , proc_dointvec_minmax, true ); -set_table_entry (&table[6 ] ,"forkexec_idx" , &sd->forkexec_idx,sizeof (int ) ,0644 , proc_dointvec_minmax, true ); -set_table_entry (&table[7 ] ,"busy_factor" , &sd->busy_factor,sizeof (int ) ,0644 , proc_dointvec_minmax, false); -set_table_entry (&table[8 ] ,"imbalance_pct" , &sd->imbalance_pct,sizeof (int ) ,0644 , proc_dointvec_minmax, false); -set_table_entry (&table[9 ] ,"cache_nice_tries" , &sd->cache_nice_tries,sizeof (int ) ,0644 , proc_dointvec_minmax, false); -set_table_entry (&table[10 ],"flags" , &sd->flags,sizeof (int ) ,0644 , proc_dointvec_minmax, false); -set_table_entry (&table[11 ],"max_newidle_lb_cost" , &sd->max_newidle_lb_cost,sizeof (long ),0644 , proc_doulongvec_minmax, false); -set_table_entry (&table[12 ],"name" , sd->name,CORENAME_MAX_SIZE ,0444 , proc_dostring, false); +set_table_entry (&table[0 ],"min_interval" , &sd->min_interval,sizeof (long ),0644 , proc_doulongvec_minmax); +set_table_entry (&table[1 ],"max_interval" , &sd->max_interval,sizeof (long ),0644 , proc_doulongvec_minmax); +set_table_entry (&table[2 ],"busy_idx" , &sd->busy_idx,sizeof (int ),0644 , proc_dointvec_minmax); +set_table_entry (&table[3 ],"idle_idx" , &sd->idle_idx,sizeof (int ),0644 , proc_dointvec_minmax); +set_table_entry (&table[4 ],"newidle_idx" , &sd->newidle_idx,sizeof (int ),0644 , proc_dointvec_minmax); +set_table_entry (&table[5 ],"wake_idx" , &sd->wake_idx,sizeof (int ),0644 , proc_dointvec_minmax); +set_table_entry (&table[6 ],"forkexec_idx" , &sd->forkexec_idx,sizeof (int ),0644 , proc_dointvec_minmax); +set_table_entry (&table[7 ],"busy_factor" , &sd->busy_factor,sizeof (int ),0644 , proc_dointvec_minmax); +set_table_entry (&table[8 ],"imbalance_pct" , &sd->imbalance_pct,sizeof (int ),0644 , proc_dointvec_minmax); +set_table_entry (&table[9 ],"cache_nice_tries" , &sd->cache_nice_tries,sizeof (int ),0644 , proc_dointvec_minmax); +set_table_entry (&table[10 ],"flags" , &sd->flags,sizeof (int ),0644 , proc_dointvec_minmax); +set_table_entry (&table[11 ],"max_newidle_lb_cost" , &sd->max_newidle_lb_cost,sizeof (long ),0644 , proc_doulongvec_minmax); +set_table_entry (&table[12 ],"name" , sd->name,CORENAME_MAX_SIZE ,0444 , proc_dostring);/* &table[13] is terminator */ return table;
Dietmar Eggemann
reviewerPATCH 4/7 sched: Remove rq->cpu_load[]
In reply to Dietmar EggemannThe per rq load array values also disappear from the cpu#X sections in /proc/sched_debug.
--- kernel/sched/core.c | 6 +----- kernel/sched/debug.c | 5 ----- kernel/sched/sched.h | 2 -- 3 files changed, 1 insertion(+), 12 deletions(-)
kernel/sched/core.c +1 -5
@@ -5900,8 +5900,8 @@ DECLARE_PER_CPU(cpumask_var_t, select_idle_mask);void __init sched_init (void ) { -int i, j;unsigned long alloc_size =0 , ptr; +int i;wait_bit_init ();
@@ -6003,10 +6003,6 @@ void __init sched_init(void)#ifdef CONFIG_RT_GROUP_SCHED init_tg_rt_entry (&root_task_group, &rq->rt,NULL , i,NULL );#endif - -for (j =0 ; j <CPU_LOAD_IDX_MAX ; j++) - rq->cpu_load[j] =0 ; -#ifdef CONFIG_SMP rq->sd =NULL ; rq->rd =NULL ;
kernel/sched/debug.c +0 -5
@@ -656,11 +656,6 @@ do { \SEQ_printf (m," .%-30s: %ld\n" ,"curr->pid" , (long )(task_pid_nr (rq->curr)));PN (clock);PN (clock_task); -P (cpu_load[0 ]); -P (cpu_load[1 ]); -P (cpu_load[2 ]); -P (cpu_load[3 ]); -P (cpu_load[4 ]);#undef P#undef PN
kernel/sched/sched.h +0 -2
@@ -812,8 +812,6 @@ struct rq {unsigned int nr_preferred_running;unsigned int numa_migrate_on;#endif -#define CPU_LOAD_IDX_MAX 5 -unsigned long cpu_load[CPU_LOAD_IDX_MAX ];#ifdef CONFIG_NO_HZ_COMMON #ifdef CONFIG_SMP unsigned long last_load_update_tick;
Signature · 1 line
2.17.1
Re: [PATCH 4/7] sched: Remove rq->cpu_load[]
Quoted 5 lines · Dietmar Eggemann
The per rq load array values also disappear from the cpu#X sections in
/proc/sched_debug.Signed-off-by Dietmar Eggemann <[email protected]>
tip-bot for Dietmar Eggemann
merge bot[tip:sched/core] sched/core: Remove rq->cpu_load[]
In reply to Dietmar Eggemannsched/core: Remove rq->cpu_load[]
Commit-ID: 55627e3cd22c315c4a02fe3bbbb7234ec439cb1d Gitweb: https://git.kernel.org/tip/55627e3cd22c315c4a02fe3bbbb7234ec439cb1d Author: Dietmar Eggemann <[email protected]> AuthorDate: Mon, 27 May 2019 07:21:13 +0100 Committer: Ingo Molnar <[email protected]> CommitDate: Mon, 3 Jun 2019 11:49:40 +0200
sched/core: Remove rq->cpu_load[]
The per rq load array values also disappear from the cpu#X sections in /proc/sched_debug.
--- kernel/sched/core.c | 6 +----- kernel/sched/debug.c | 5 ----- kernel/sched/sched.h | 2 -- 3 files changed, 1 insertion(+), 12 deletions(-)
kernel/sched/core.c +1 -5
@@ -5901,8 +5901,8 @@ DECLARE_PER_CPU(cpumask_var_t, select_idle_mask);void __init sched_init (void ) { -int i, j;unsigned long alloc_size =0 , ptr; +int i;wait_bit_init ();
@@ -6004,10 +6004,6 @@ void __init sched_init(void)#ifdef CONFIG_RT_GROUP_SCHED init_tg_rt_entry (&root_task_group, &rq->rt,NULL , i,NULL );#endif - -for (j =0 ; j <CPU_LOAD_IDX_MAX ; j++) - rq->cpu_load[j] =0 ; -#ifdef CONFIG_SMP rq->sd =NULL ; rq->rd =NULL ;
kernel/sched/debug.c +0 -5
@@ -654,11 +654,6 @@ do { \SEQ_printf (m," .%-30s: %ld\n" ,"curr->pid" , (long )(task_pid_nr (rq->curr)));PN (clock);PN (clock_task); -P (cpu_load[0 ]); -P (cpu_load[1 ]); -P (cpu_load[2 ]); -P (cpu_load[3 ]); -P (cpu_load[4 ]);#undef P#undef PN
kernel/sched/sched.h +0 -2
@@ -812,8 +812,6 @@ struct rq {unsigned int nr_preferred_running;unsigned int numa_migrate_on;#endif -#define CPU_LOAD_IDX_MAX 5 -unsigned long cpu_load[CPU_LOAD_IDX_MAX ];#ifdef CONFIG_NO_HZ_COMMON #ifdef CONFIG_SMP unsigned long last_load_update_tick;
Dietmar Eggemann
reviewerPATCH 5/7 sched: Remove sd->*_idx
In reply to Dietmar EggemannThe sched domain per rq load index files also disappear from the /proc/sys/kernel/sched_domain/cpuX/domainY directories.
--- include/linux/sched/topology.h | 5 ----- kernel/sched/debug.c | 25 ++++++++++--------------- kernel/sched/topology.c | 10 ---------- 3 files changed, 10 insertions(+), 30 deletions(-)
include/linux/sched/topology.h +0 -5
@@ -84,11 +84,6 @@ struct sched_domain {unsigned int busy_factor;/* less balancing by factor if busy */ unsigned int imbalance_pct;/* No balance until over watermark */ unsigned int cache_nice_tries;/* Leave cache hot tasks for # tries */ -unsigned int busy_idx; -unsigned int idle_idx; -unsigned int newidle_idx; -unsigned int wake_idx; -unsigned int forkexec_idx;int nohz_idle;/* NOHZ IDLE status */ int flags;/* See SD_* */
kernel/sched/debug.c +10 -15
@@ -251,25 +251,20 @@ set_table_entry(struct ctl_table *entry,static struct ctl_table *sd_alloc_ctl_domain_table (struct sched_domain *sd) { -struct ctl_table *table =sd_alloc_ctl_entry (14 ); +struct ctl_table *table =sd_alloc_ctl_entry (9 );if (table ==NULL )return NULL ; -set_table_entry (&table[0 ],"min_interval" , &sd->min_interval,sizeof (long ),0644 , proc_doulongvec_minmax); -set_table_entry (&table[1 ],"max_interval" , &sd->max_interval,sizeof (long ),0644 , proc_doulongvec_minmax); -set_table_entry (&table[2 ],"busy_idx" , &sd->busy_idx,sizeof (int ),0644 , proc_dointvec_minmax); -set_table_entry (&table[3 ],"idle_idx" , &sd->idle_idx,sizeof (int ),0644 , proc_dointvec_minmax); -set_table_entry (&table[4 ],"newidle_idx" , &sd->newidle_idx,sizeof (int ),0644 , proc_dointvec_minmax); -set_table_entry (&table[5 ],"wake_idx" , &sd->wake_idx,sizeof (int ),0644 , proc_dointvec_minmax); -set_table_entry (&table[6 ],"forkexec_idx" , &sd->forkexec_idx,sizeof (int ),0644 , proc_dointvec_minmax); -set_table_entry (&table[7 ],"busy_factor" , &sd->busy_factor,sizeof (int ),0644 , proc_dointvec_minmax); -set_table_entry (&table[8 ],"imbalance_pct" , &sd->imbalance_pct,sizeof (int ),0644 , proc_dointvec_minmax); -set_table_entry (&table[9 ],"cache_nice_tries" , &sd->cache_nice_tries,sizeof (int ),0644 , proc_dointvec_minmax); -set_table_entry (&table[10 ],"flags" , &sd->flags,sizeof (int ),0644 , proc_dointvec_minmax); -set_table_entry (&table[11 ],"max_newidle_lb_cost" , &sd->max_newidle_lb_cost,sizeof (long ),0644 , proc_doulongvec_minmax); -set_table_entry (&table[12 ],"name" , sd->name,CORENAME_MAX_SIZE ,0444 , proc_dostring); -/* &table[13] is terminator */ +set_table_entry (&table[0 ],"min_interval" , &sd->min_interval,sizeof (long ),0644 , proc_doulongvec_minmax); +set_table_entry (&table[1 ],"max_interval" , &sd->max_interval,sizeof (long ),0644 , proc_doulongvec_minmax); +set_table_entry (&table[2 ],"busy_factor" , &sd->busy_factor,sizeof (int ),0644 , proc_dointvec_minmax); +set_table_entry (&table[3 ],"imbalance_pct" , &sd->imbalance_pct,sizeof (int ),0644 , proc_dointvec_minmax); +set_table_entry (&table[4 ],"cache_nice_tries" , &sd->cache_nice_tries,sizeof (int ),0644 , proc_dointvec_minmax); +set_table_entry (&table[5 ],"flags" , &sd->flags,sizeof (int ),0644 , proc_dointvec_minmax); +set_table_entry (&table[6 ],"max_newidle_lb_cost" , &sd->max_newidle_lb_cost,sizeof (long ),0644 , proc_doulongvec_minmax); +set_table_entry (&table[7 ],"name" , sd->name,CORENAME_MAX_SIZE ,0444 , proc_dostring); +/* &table[8] is terminator */ return table; }
kernel/sched/topology.c +0 -10
@@ -1344,11 +1344,6 @@ sd_init(struct sched_domain_topology_level *tl, .imbalance_pct = 125, .cache_nice_tries =0 , - .busy_idx = 0, - .idle_idx = 0, - .newidle_idx = 0, - .wake_idx = 0, - .forkexec_idx =0 , .flags = 1*SD_LOAD_BALANCE |1 *SD_BALANCE_NEWIDLE
@@ -1400,13 +1395,10 @@ sd_init(struct sched_domain_topology_level *tl, }else if (sd->flags &SD_SHARE_PKG_RESOURCES ) { sd->imbalance_pct =117 ; sd->cache_nice_tries =1 ; - sd->busy_idx =2 ; #ifdef CONFIG_NUMA }else if (sd->flags &SD_NUMA ) { sd->cache_nice_tries =2 ; - sd->busy_idx =3 ; - sd->idle_idx =2 ; sd->flags &= ~SD_PREFER_SIBLING ; sd->flags |=SD_SERIALIZE ;
@@ -1419,8 +1411,6 @@ sd_init(struct sched_domain_topology_level *tl,#endif }else { sd->cache_nice_tries =1 ; - sd->busy_idx =2 ; - sd->idle_idx =1 ; }/*
Signature · 1 line
2.17.1
Re: [PATCH 5/7] sched: Remove sd->*_idx
Quoted 4 lines · Dietmar Eggemann
The sched domain per rq load index files also disappear from the
/proc/sys/kernel/sched_domain/cpuX/domainYdirectories.Signed-off-by Dietmar Eggemann <[email protected]>
tip-bot for Dietmar Eggemann
merge bot[tip:sched/core] sched/core: Remove sd->*_idx
In reply to Dietmar Eggemannsched/core: Remove sd->*_idx
Commit-ID: 0e1fef63d92d61ed561e504c3a078a827a0f9bfe Gitweb: https://git.kernel.org/tip/0e1fef63d92d61ed561e504c3a078a827a0f9bfe Author: Dietmar Eggemann <[email protected]> AuthorDate: Mon, 27 May 2019 07:21:14 +0100 Committer: Ingo Molnar <[email protected]> CommitDate: Mon, 3 Jun 2019 11:49:40 +0200
sched/core: Remove sd->*_idx
The sched domain per rq load index files also disappear from the /proc/sys/kernel/sched_domain/cpuX/domainY directories.
--- include/linux/sched/topology.h | 5 ----- kernel/sched/debug.c | 25 ++++++++++--------------- kernel/sched/topology.c | 10 ---------- 3 files changed, 10 insertions(+), 30 deletions(-)
include/linux/sched/topology.h +0 -5
@@ -84,11 +84,6 @@ struct sched_domain {unsigned int busy_factor;/* less balancing by factor if busy */ unsigned int imbalance_pct;/* No balance until over watermark */ unsigned int cache_nice_tries;/* Leave cache hot tasks for # tries */ -unsigned int busy_idx; -unsigned int idle_idx; -unsigned int newidle_idx; -unsigned int wake_idx; -unsigned int forkexec_idx;int nohz_idle;/* NOHZ IDLE status */ int flags;/* See SD_* */
kernel/sched/debug.c +10 -15
@@ -251,25 +251,20 @@ set_table_entry(struct ctl_table *entry,static struct ctl_table *sd_alloc_ctl_domain_table (struct sched_domain *sd) { -struct ctl_table *table =sd_alloc_ctl_entry (14 ); +struct ctl_table *table =sd_alloc_ctl_entry (9 );if (table ==NULL )return NULL ; -set_table_entry (&table[0 ],"min_interval" , &sd->min_interval,sizeof (long ),0644 , proc_doulongvec_minmax); -set_table_entry (&table[1 ],"max_interval" , &sd->max_interval,sizeof (long ),0644 , proc_doulongvec_minmax); -set_table_entry (&table[2 ],"busy_idx" , &sd->busy_idx,sizeof (int ),0644 , proc_dointvec_minmax); -set_table_entry (&table[3 ],"idle_idx" , &sd->idle_idx,sizeof (int ),0644 , proc_dointvec_minmax); -set_table_entry (&table[4 ],"newidle_idx" , &sd->newidle_idx,sizeof (int ),0644 , proc_dointvec_minmax); -set_table_entry (&table[5 ],"wake_idx" , &sd->wake_idx,sizeof (int ),0644 , proc_dointvec_minmax); -set_table_entry (&table[6 ],"forkexec_idx" , &sd->forkexec_idx,sizeof (int ),0644 , proc_dointvec_minmax); -set_table_entry (&table[7 ],"busy_factor" , &sd->busy_factor,sizeof (int ),0644 , proc_dointvec_minmax); -set_table_entry (&table[8 ],"imbalance_pct" , &sd->imbalance_pct,sizeof (int ),0644 , proc_dointvec_minmax); -set_table_entry (&table[9 ],"cache_nice_tries" , &sd->cache_nice_tries,sizeof (int ),0644 , proc_dointvec_minmax); -set_table_entry (&table[10 ],"flags" , &sd->flags,sizeof (int ),0644 , proc_dointvec_minmax); -set_table_entry (&table[11 ],"max_newidle_lb_cost" , &sd->max_newidle_lb_cost,sizeof (long ),0644 , proc_doulongvec_minmax); -set_table_entry (&table[12 ],"name" , sd->name,CORENAME_MAX_SIZE ,0444 , proc_dostring); -/* &table[13] is terminator */ +set_table_entry (&table[0 ],"min_interval" , &sd->min_interval,sizeof (long ),0644 , proc_doulongvec_minmax); +set_table_entry (&table[1 ],"max_interval" , &sd->max_interval,sizeof (long ),0644 , proc_doulongvec_minmax); +set_table_entry (&table[2 ],"busy_factor" , &sd->busy_factor,sizeof (int ),0644 , proc_dointvec_minmax); +set_table_entry (&table[3 ],"imbalance_pct" , &sd->imbalance_pct,sizeof (int ),0644 , proc_dointvec_minmax); +set_table_entry (&table[4 ],"cache_nice_tries" , &sd->cache_nice_tries,sizeof (int ),0644 , proc_dointvec_minmax); +set_table_entry (&table[5 ],"flags" , &sd->flags,sizeof (int ),0644 , proc_dointvec_minmax); +set_table_entry (&table[6 ],"max_newidle_lb_cost" , &sd->max_newidle_lb_cost,sizeof (long ),0644 , proc_doulongvec_minmax); +set_table_entry (&table[7 ],"name" , sd->name,CORENAME_MAX_SIZE ,0444 , proc_dostring); +/* &table[8] is terminator */ return table; }
kernel/sched/topology.c +0 -10
@@ -1344,11 +1344,6 @@ sd_init(struct sched_domain_topology_level *tl, .imbalance_pct = 125, .cache_nice_tries =0 , - .busy_idx = 0, - .idle_idx = 0, - .newidle_idx = 0, - .wake_idx = 0, - .forkexec_idx =0 , .flags = 1*SD_LOAD_BALANCE |1 *SD_BALANCE_NEWIDLE
@@ -1400,13 +1395,10 @@ sd_init(struct sched_domain_topology_level *tl, }else if (sd->flags &SD_SHARE_PKG_RESOURCES ) { sd->imbalance_pct =117 ; sd->cache_nice_tries =1 ; - sd->busy_idx =2 ; #ifdef CONFIG_NUMA }else if (sd->flags &SD_NUMA ) { sd->cache_nice_tries =2 ; - sd->busy_idx =3 ; - sd->idle_idx =2 ; sd->flags &= ~SD_PREFER_SIBLING ; sd->flags |=SD_SERIALIZE ;
@@ -1419,8 +1411,6 @@ sd_init(struct sched_domain_topology_level *tl,#endif }else { sd->cache_nice_tries =1 ; - sd->busy_idx =2 ; - sd->idle_idx =1 ; }/*
Dietmar Eggemann
reviewerPATCH 6/7 sched/fair: Remove sgs->sum_weighted_load
In reply to Dietmar EggemannSince sg_lb_stats::sum_weighted_load is now identical with sg_lb_stats::group_load remove it and replace its use case (calculating load per task) with the latter.
--- kernel/sched/fair.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
kernel/sched/fair.c +1 -3
@@ -7580,7 +7580,6 @@ static unsigned long task_h_load(struct task_struct *p)struct sg_lb_stats {unsigned long avg_load;/*Avg load across the CPUs of the group */ unsigned long group_load;/* Total load over the CPUs of the group */ -unsigned long sum_weighted_load;/* Weighted load of group's tasks */ unsigned long load_per_task;unsigned long group_capacity;unsigned long group_util;/* Total utilization of the group */
@@ -7947,7 +7946,6 @@ static inline void update_sg_lb_stats(struct lb_env *env, sgs->nr_numa_running += rq->nr_numa_running; sgs->nr_preferred_running += rq->nr_preferred_running;#endif - sgs->sum_weighted_load +=weighted_cpuload (rq);/* * No need to call idle_cpu() if nr_running is not 0 */
@@ -7966,7 +7964,7 @@ static inline void update_sg_lb_stats(struct lb_env *env, sgs->avg_load = (sgs->group_load*SCHED_CAPACITY_SCALE ) / sgs->group_capacity;if (sgs->sum_nr_running) - sgs->load_per_task = sgs->sum_weighted_load / sgs->sum_nr_running; + sgs->load_per_task = sgs->group_load / sgs->sum_nr_running; sgs->group_weight = group->group_weight;
Signature · 1 line
2.17.1
Re: [PATCH 6/7] sched/fair: Remove sgs->sum_weighted_load
Quoted 6 lines · Dietmar Eggemann
Since
sg_lb_stats::sum_weighted_loadis now identical withsg_lb_stats::group_loadremove it and replace its use case (calculating load per task) with the latter.Signed-off-by Dietmar Eggemann <[email protected]>
FWIW
Quoted 36 lines
--- kernel/sched/fair.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)kernel/sched/fair.c +1
-4@@ -7580,7 +7580,6 @@ static unsigned long task_h_load(struct task_struct *p)struct sg_lb_stats {unsigned long avg_load;/*Avg load across the CPUs of the group */ unsigned long group_load;/* Total load over the CPUs of the group */ -unsigned long sum_weighted_load;/* Weighted load of group's tasks */ unsigned long load_per_task;unsigned long group_capacity;unsigned long group_util;/* Total utilization of the group */ @@ -7947,7 +7946,6 @@ static inline void update_sg_lb_stats(struct lb_env *env, sgs->nr_numa_running += rq->nr_numa_running; sgs->nr_preferred_running += rq->nr_preferred_running;#endif - sgs->sum_weighted_load +=weighted_cpuload (rq);/* * No need to call idle_cpu() if nr_running is not 0 */ @@ -7966,7 +7964,7 @@ static inline void update_sg_lb_stats(struct lb_env *env, sgs->avg_load = (sgs->group_load*SCHED_CAPACITY_SCALE ) / sgs->group_capacity;if (sgs->sum_nr_running) - sgs->load_per_task = sgs->sum_weighted_load / sgs->sum_nr_running; + sgs->load_per_task = sgs->group_load / sgs->sum_nr_running; sgs->group_weight = group->group_weight; --2.17.1
Re: [PATCH 6/7] sched/fair: Remove sgs->sum_weighted_load
In reply to Dietmar EggemannQuoted 5 lines · Dietmar Eggemann
Since
sg_lb_stats::sum_weighted_loadis now identical withsg_lb_stats::group_loadremove it and replace its use case (calculating load per task) with the latter.Signed-off-by Dietmar Eggemann <[email protected]>
Signature · 1 line
All Rights Reversed.
tip-bot for Dietmar Eggemann
merge bot[tip:sched/core] sched/fair: Remove sgs->sum_weighted_load
In reply to Dietmar Eggemannsched/fair: Remove sgs->sum_weighted_load
Commit-ID: af75d1a9a9f75bf030c2f35705f1ff6d226f96fe Gitweb: https://git.kernel.org/tip/af75d1a9a9f75bf030c2f35705f1ff6d226f96fe Author: Dietmar Eggemann <[email protected]> AuthorDate: Mon, 27 May 2019 07:21:15 +0100 Committer: Ingo Molnar <[email protected]> CommitDate: Mon, 3 Jun 2019 11:49:41 +0200
sched/fair: Remove sgs->sum_weighted_load
Since sg_lb_stats::sum_weighted_load is now identical with sg_lb_stats::group_load remove it and replace its use case (calculating load per task) with the latter.
--- kernel/sched/fair.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
kernel/sched/fair.c +1 -3
@@ -7577,7 +7577,6 @@ static unsigned long task_h_load(struct task_struct *p)struct sg_lb_stats {unsigned long avg_load;/*Avg load across the CPUs of the group */ unsigned long group_load;/* Total load over the CPUs of the group */ -unsigned long sum_weighted_load;/* Weighted load of group's tasks */ unsigned long load_per_task;unsigned long group_capacity;unsigned long group_util;/* Total utilization of the group */
@@ -7944,7 +7943,6 @@ static inline void update_sg_lb_stats(struct lb_env *env, sgs->nr_numa_running += rq->nr_numa_running; sgs->nr_preferred_running += rq->nr_preferred_running;#endif - sgs->sum_weighted_load +=weighted_cpuload (rq);/* * No need to call idle_cpu() if nr_running is not 0 */
@@ -7963,7 +7961,7 @@ static inline void update_sg_lb_stats(struct lb_env *env, sgs->avg_load = (sgs->group_load*SCHED_CAPACITY_SCALE ) / sgs->group_capacity;if (sgs->sum_nr_running) - sgs->load_per_task = sgs->sum_weighted_load / sgs->sum_nr_running; + sgs->load_per_task = sgs->group_load / sgs->sum_nr_running; sgs->group_weight = group->group_weight;
Dietmar Eggemann
reviewerPATCH 7/7 sched/fair: Rename weighted_cpuload() to cpu_load()
In reply to Dietmar EggemannThis is done to align the per cpu (i.e. per rq) load with the util counterpart (cpu_util(int cpu)). The term 'weighted' is not needed since there is no 'unweighted' load to distinguish it from.
--- kernel/sched/fair.c | 44 ++++++++++++++++++++------------------------ 1 file changed, 20 insertions(+), 24 deletions(-)
kernel/sched/fair.c +20 -24
@@ -1466,7 +1466,7 @@ bool should_numa_migrate_memory(struct task_struct *p, struct page * page,group_faults_cpu (ng, src_nid) *group_faults (p, dst_nid) *4 ; } -static unsigned long weighted_cpuload (struct rq *rq); +static unsigned long cpu_load (int cpu);/* Cached statistics for all CPUs within a node */ struct numa_stats {
@@ -1485,9 +1485,7 @@ static void update_numa_stats(struct numa_stats *ns, int nid)memset (ns,0 ,sizeof (*ns));for_each_cpu (cpu,cpumask_of_node (nid)) { -struct rq *rq =cpu_rq (cpu); - - ns->load +=weighted_cpuload (rq); + ns->load +=cpu_load (cpu); ns->compute_capacity +=capacity_of (cpu); }
@@ -5334,9 +5332,9 @@ static struct {#endif /* CONFIG_NO_HZ_COMMON */ -static unsigned long weighted_cpuload (struct rq *rq) +static unsigned long cpu_load (int cpu) { -return cfs_rq_runnable_load_avg (&rq->cfs); +return cfs_rq_runnable_load_avg (&cpu_rq (cpu)->cfs); }static unsigned long capacity_of (int cpu)
@@ -5348,7 +5346,7 @@ static unsigned long cpu_avg_load_per_task(int cpu) {struct rq *rq =cpu_rq (cpu);unsigned long nr_running =READ_ONCE (rq->cfs.h_nr_running); -unsigned long load_avg =weighted_cpuload (rq); +unsigned long load_avg =cpu_load (cpu);if (nr_running)return load_avg / nr_running;
@@ -5446,7 +5444,7 @@ wake_affine_weight(struct sched_domain *sd, struct task_struct *p,s64 this_eff_load, prev_eff_load;unsigned long task_load; - this_eff_load =weighted_cpuload (cpu_rq (this_cpu)); + this_eff_load =cpu_load (this_cpu);if (sync) {unsigned long current_load =task_h_load (current);
@@ -5464,7 +5462,7 @@ wake_affine_weight(struct sched_domain *sd, struct task_struct *p, this_eff_load *=100 ; this_eff_load *=capacity_of (prev_cpu); - prev_eff_load =weighted_cpuload (cpu_rq (this_cpu)); + prev_eff_load =cpu_load (this_cpu); prev_eff_load -= task_load;if (sched_feat (WA_BIAS )) prev_eff_load *=100 + (sd->imbalance_pct -100 ) /2 ;
@@ -5552,7 +5550,7 @@ find_idlest_group(struct sched_domain *sd, struct task_struct *p, max_spare_cap =0 ;for_each_cpu (i,sched_group_span (group)) { - load =weighted_cpuload (cpu_rq (i)); + load =cpu_load (i); runnable_load += load; avg_load +=cfs_rq_load_avg (&cpu_rq (i)->cfs);
@@ -5688,7 +5686,7 @@ find_idlest_group_cpu(struct sched_group *group, struct task_struct *p, int this shallowest_idle_cpu = i; } }else if (shallowest_idle_cpu ==-1 ) { - load =weighted_cpuload (cpu_rq (i)); + load =cpu_load (i);if (load < min_load) { min_load = load; least_loaded_cpu = i;
@@ -7259,8 +7257,8 @@ static struct task_struct *detach_one_task(struct lb_env *env)static const unsigned int sched_nr_migrate_break =32 ;/* -* detach_tasks() -- tries to detach up to imbalance weighted load from -* busiest_rq, as part of a balancing operation within domain "sd". +* detach_tasks() -- tries to detach up to imbalance load from busiest_rq, +* as part of a balancing operation within domain "sd". * * Returns number of detached tasks if successful and 0 otherwise. */
@@ -7326,8 +7324,7 @@ static int detach_tasks(struct lb_env *env)#endif /* -* We only want to steal up to the prescribed amount of -* weighted load. +* We only want to steal up to the prescribed amount of load. */ if (env->imbalance <=0 )break ;
@@ -7931,7 +7928,7 @@ static inline void update_sg_lb_stats(struct lb_env *env,if ((env->flags &LBF_NOHZ_STATS ) &&update_nohz_stats (rq, false)) env->flags |=LBF_NOHZ_AGAIN ; - sgs->group_load +=weighted_cpuload (rq); + sgs->group_load +=cpu_load (i); sgs->group_util +=cpu_util (i); sgs->sum_nr_running += rq->cfs.h_nr_running;
@@ -8385,8 +8382,7 @@ static inline void calculate_imbalance(struct lb_env *env, struct sd_lb_stats *s* find_busiest_group - Returns the busiest group within the sched_domain * if there is an imbalance. * -* Also calculates the amount of weighted load which should be moved -* to restore balance. +* Also calculates the amount of load which should be moved to restore balance. * * @env: The load balancing environment. *
@@ -8558,11 +8554,11 @@ static struct rq *find_busiest_queue(struct lb_env *env, rq->nr_running == 1)continue ; - wl =weighted_cpuload (rq); + wl =cpu_load (i);/* -* When comparing with imbalance, use weighted_cpuload() -* which is not scaled with the CPU capacity. +* When comparing with imbalance, use cpu_load() which is not +* scaled with the CPU capacity. */ if (rq->nr_running == 1 && wl > env->imbalance &&
@@ -8571,9 +8567,9 @@ static struct rq *find_busiest_queue(struct lb_env *env,/* * For the load comparisons with the other CPU's, consider -* the weighted_cpuload() scaled with the CPU capacity, so -* that the load can be moved away from the CPU that is -* potentially running at a lower capacity. +* the cpu_load() scaled with the CPU capacity, so that the +* load can be moved away from the CPU that is potentially +* running at a lower capacity. * * Thus we're looking for max(wl_i / capacity_i), crosswise * multiplication to rid ourselves of the division works out
Signature · 1 line
2.17.1
Vincent Guittot
maintainerRe: [PATCH 7/7] sched/fair: Rename weighted_cpuload() to cpu_load()
Quoted 35 lines · Dietmar Eggemann
This is done to align the per cpu (i.e. per rq) load with the util counterpart (
cpu_util(int cpu)). The term 'weighted' is not needed since there is no 'unweighted' load to distinguish it from.Signed-off-by Dietmar Eggemann <[email protected]>--- kernel/sched/fair.c | 44 ++++++++++++++++++++------------------------ 1 file changed, 20 insertions(+), 24 deletions(-)kernel/sched/fair.c +2
-4@@ -1466,7 +1466,7 @@ bool should_numa_migrate_memory(struct task_struct *p, struct page * page,group_faults_cpu (ng, src_nid) *group_faults (p, dst_nid) *4 ; } -static unsigned long weighted_cpuload (struct rq *rq); +static unsigned long cpu_load (int cpu);/* Cached statistics for all CPUs within a node */ struct numa_stats {@@ -1485,9 +1485,7 @@ static void update_numa_stats(struct numa_stats *ns, int nid)memset (ns,0 ,sizeof (*ns));for_each_cpu (cpu,cpumask_of_node (nid)) { -struct rq *rq =cpu_rq (cpu); - - ns->load +=weighted_cpuload (rq); + ns->load +=cpu_load (cpu); ns->compute_capacity +=capacity_of (cpu); }
kernel/sched/fair.c static struct { · line 5335
Quoted 5 lines
kernel/sched/fair.c +1
-1@@ -5334,9 +5332,9 @@ static struct {#endif /* CONFIG_NO_HZ_COMMON */ -static unsigned long weighted_cpuload (struct rq *rq) +static unsigned long cpu_load (int cpu)
it would be better to use cpu_runnable_load instead of cpu_load because it returns runnable_load_avg and not load_avg
Quoted 122 lines
kernel/sched/fair.c +17
-20{ -return cfs_rq_runnable_load_avg (&rq->cfs); +return cfs_rq_runnable_load_avg (&cpu_rq (cpu)->cfs); }static unsigned long capacity_of (int cpu)@@ -5348,7 +5346,7 @@ static unsigned long cpu_avg_load_per_task(int cpu) {struct rq *rq =cpu_rq (cpu);unsigned long nr_running =READ_ONCE (rq->cfs.h_nr_running); -unsigned long load_avg =weighted_cpuload (rq); +unsigned long load_avg =cpu_load (cpu);if (nr_running)return load_avg / nr_running;@@ -5446,7 +5444,7 @@ wake_affine_weight(struct sched_domain *sd, struct task_struct *p,s64 this_eff_load, prev_eff_load;unsigned long task_load; - this_eff_load =weighted_cpuload (cpu_rq (this_cpu)); + this_eff_load =cpu_load (this_cpu);if (sync) {unsigned long current_load =task_h_load (current);@@ -5464,7 +5462,7 @@ wake_affine_weight(struct sched_domain *sd, struct task_struct *p, this_eff_load *=100 ; this_eff_load *=capacity_of (prev_cpu); - prev_eff_load =weighted_cpuload (cpu_rq (this_cpu)); + prev_eff_load =cpu_load (this_cpu); prev_eff_load -= task_load;if (sched_feat (WA_BIAS )) prev_eff_load *=100 + (sd->imbalance_pct -100 ) /2 ;@@ -5552,7 +5550,7 @@ find_idlest_group(struct sched_domain *sd, struct task_struct *p, max_spare_cap =0 ;for_each_cpu (i,sched_group_span (group)) { - load =weighted_cpuload (cpu_rq (i)); + load =cpu_load (i); runnable_load += load; avg_load +=cfs_rq_load_avg (&cpu_rq (i)->cfs);@@ -5688,7 +5686,7 @@ find_idlest_group_cpu(struct sched_group *group, struct task_struct *p, int this shallowest_idle_cpu = i; } }else if (shallowest_idle_cpu ==-1 ) { - load =weighted_cpuload (cpu_rq (i)); + load =cpu_load (i);if (load < min_load) { min_load = load; least_loaded_cpu = i;@@ -7259,8 +7257,8 @@ static struct task_struct *detach_one_task(struct lb_env *env)static const unsigned int sched_nr_migrate_break =32 ;/* -* detach_tasks() -- tries to detach up to imbalance weighted load from -* busiest_rq, as part of a balancing operation within domain "sd". +* detach_tasks() -- tries to detach up to imbalance load from busiest_rq, +* as part of a balancing operation within domain "sd". * * Returns number of detached tasks if successful and 0 otherwise. */ @@ -7326,8 +7324,7 @@ static int detach_tasks(struct lb_env *env)#endif /* -* We only want to steal up to the prescribed amount of -* weighted load. +* We only want to steal up to the prescribed amount of load. */ if (env->imbalance <=0 )break ;@@ -7931,7 +7928,7 @@ static inline void update_sg_lb_stats(struct lb_env *env,if ((env->flags &LBF_NOHZ_STATS ) &&update_nohz_stats (rq, false)) env->flags |=LBF_NOHZ_AGAIN ; - sgs->group_load +=weighted_cpuload (rq); + sgs->group_load +=cpu_load (i); sgs->group_util +=cpu_util (i); sgs->sum_nr_running += rq->cfs.h_nr_running;@@ -8385,8 +8382,7 @@ static inline void calculate_imbalance(struct lb_env *env, struct sd_lb_stats *s* find_busiest_group - Returns the busiest group within the sched_domain * if there is an imbalance. * -* Also calculates the amount of weighted load which should be moved -* to restore balance. +* Also calculates the amount of load which should be moved to restore balance. * * @env: The load balancing environment. * @@ -8558,11 +8554,11 @@ static struct rq *find_busiest_queue(struct lb_env *env, rq->nr_running == 1)continue ; - wl =weighted_cpuload (rq); + wl =cpu_load (i);/* -* When comparing with imbalance, use weighted_cpuload() -* which is not scaled with the CPU capacity. +* When comparing with imbalance, use cpu_load() which is not +* scaled with the CPU capacity. */ if (rq->nr_running == 1 && wl > env->imbalance &&@@ -8571,9 +8567,9 @@ static struct rq *find_busiest_queue(struct lb_env *env,/* * For the load comparisons with the other CPU's, consider -* the weighted_cpuload() scaled with the CPU capacity, so -* that the load can be moved away from the CPU that is -* potentially running at a lower capacity. +* the cpu_load() scaled with the CPU capacity, so that the +* load can be moved away from the CPU that is potentially +* running at a lower capacity. * * Thus we're looking for max(wl_i / capacity_i), crosswise * multiplication to rid ourselves of the division works out -- 2.17.1
Re: [PATCH 7/7] sched/fair: Rename weighted_cpuload() to cpu_load()
In reply to Dietmar EggemannQuoted 3 lines · Dietmar Eggemann
This is done to align the per cpu (i.e. per rq) load with the util counterpart (
cpu_util(int cpu)). The term 'weighted' is not needed since there is no 'unweighted' load to distinguish it from.
I can see why you want to make cpu_util() and cpu_load() have the same parameter, but ...
Quoted 10 lines
kernel/sched/fair.c +1
-1@@ -7931,7 +7928,7 @@ static inline void update_sg_lb_stats(struct lb_env *env, if ((env->flags & LBF_NOHZ_STATS) &&update_nohz_stats (rq, false)) env->flags |= LBF_NOHZ_AGAIN; - sgs->group_load +=weighted_cpuload (rq); + sgs->group_load +=cpu_load (i); sgs->group_util +=cpu_util (i);
sgs->sum_nr_running+=rq->cfs.h_nr_running;
... now we end up dereferencing cpu_rq(cpu) 3 times.
I guess per-cpu variables are so cheap that we should never notice, but I thought I'd ask anyway while looking over these patches :)
Thank you for removing a bunch of code that slowed down my understanding of fair.c
Signature · 1 line
All Rights Reversed.
Peter Zijlstra
maintainerRe: [PATCH 7/7] sched/fair: Rename weighted_cpuload() to cpu_load()
Quoted 21 lines · Rik van Riel
Quoted 3 lines · Dietmar Eggemann
This is done to align the per cpu (i.e. per rq) load with the util counterpart (
cpu_util(int cpu)). The term 'weighted' is not needed since there is no 'unweighted' load to distinguish it from.I can see why you want to make
cpu_util()andcpu_load()have the same parameter, but ...Quoted 10 lines
kernel/sched/fair.c +1
-1@@ -7931,7 +7928,7 @@ static inline void update_sg_lb_stats(struct lb_env *env, if ((env->flags & LBF_NOHZ_STATS) &&update_nohz_stats (rq, false)) env->flags |= LBF_NOHZ_AGAIN; - sgs->group_load +=weighted_cpuload (rq); + sgs->group_load +=cpu_load (i); sgs->group_util +=cpu_util (i);
sgs->sum_nr_running+=rq->cfs.h_nr_running;... now we end up dereferencing
cpu_rq(cpu)3 times.
Quoted 3 lines
I guess per-cpu variables are so cheap that we should never notice, but I thought I'd ask anyway while looking over these patches :)
I was going to say CSE should fix that, but then I noticed per_cpu contains that hideous RELOC_HIDE() thing and I figure that might confuse GCC enough to break that :/
Dietmar Eggemann
reviewerRe: [PATCH 7/7] sched/fair: Rename weighted_cpuload() to cpu_load()
Quoted 22 lines · Peter Zijlstra
Quoted 21 lines · Rik van Riel
Quoted 3 lines · Dietmar Eggemann
This is done to align the per cpu (i.e. per rq) load with the util counterpart (
cpu_util(int cpu)). The term 'weighted' is not needed since there is no 'unweighted' load to distinguish it from.I can see why you want to make
cpu_util()andcpu_load()have the same parameter, but ...Quoted 10 lines
(quoted diff) +1
-1@@ -7931,7 +7928,7 @@ static inline void update_sg_lb_stats(struct lb_env *env, if ((env->flags & LBF_NOHZ_STATS) && update_nohz_stats(rq, false)) env->flags |= LBF_NOHZ_AGAIN; - sgs->group_load += weighted_cpuload(rq); + sgs->group_load += cpu_load(i); sgs->group_util += cpu_util(i);
sgs->sum_nr_running+=rq->cfs.h_nr_running;... now we end up dereferencing
cpu_rq(cpu)3 times.
Quoted 7 lines
Quoted 3 lines
I guess per-cpu variables are so cheap that we should never notice, but I thought I'd ask anyway while looking over these patches :)
I was going to say CSE should fix that, but then I noticed
per_cpucontains that hideousRELOC_HIDE()thing and I figure that might confuse GCC enough to break that :/
--->8---
From 25fcbbd9f654f243a70e38b0d59d38eb3c3f9313 Mon Sep 17 00:00:00 2001
From: Dietmar Eggemann <[email protected]>
Date: Mon, 13 May 2019 11:50:32 +0100
Subject: [PATCH] sched/fair: Rename weighted_cpuload() to cpu_runnable_load()
The term 'weighted' is not needed since there is no 'unweighted' load. Instead use the term 'runnable' to distinguish 'runnable' load (avg.runnable_load_avg) used in load balance from load (avg.load_avg) which is the sum of 'runnable' and 'blocked' load.
---
Related to the question whether replacing the 'struct rq *rq' parameter with 'int cpu' (cpu_rq(cpu)) for cpu_runnable_load() has an influence on the code:
RELOC_HIDE() (in per_cpu_ptr() -> SHIFT_PERCPU_PTR()) hinders the compiler to generate similar code (e.g. in update_sg_lb_stats()). When using 'int cpu' the addressing mode changed from Based Addressing to Based_indexed-Scaled. Moreover, the text size of fair.o grows by 32 bytes.
kernel/sched/fair.c | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-)
kernel/sched/fair.c +21 -21
@@ -1466,7 +1466,7 @@ bool should_numa_migrate_memory(struct task_struct *p, struct page * page,group_faults_cpu (ng, src_nid) *group_faults (p, dst_nid) *4 ; } -static unsigned long weighted_cpuload (struct rq *rq); +static unsigned long cpu_runnable_load (struct rq *rq);/* Cached statistics for all CPUs within a node */ struct numa_stats {
@@ -1487,7 +1487,7 @@ static void update_numa_stats(struct numa_stats *ns, int nid)for_each_cpu (cpu,cpumask_of_node (nid)) {struct rq *rq =cpu_rq (cpu); - ns->load +=weighted_cpuload (rq); + ns->load +=cpu_runnable_load (rq); ns->compute_capacity +=capacity_of (cpu); }
@@ -5338,7 +5338,7 @@ static struct {#endif /* CONFIG_NO_HZ_COMMON */ -static unsigned long weighted_cpuload (struct rq *rq) +static unsigned long cpu_runnable_load (struct rq *rq) {return cfs_rq_runnable_load_avg (&rq->cfs); }
@@ -5352,7 +5352,7 @@ static unsigned long cpu_avg_load_per_task(int cpu) {struct rq *rq =cpu_rq (cpu);unsigned long nr_running =READ_ONCE (rq->cfs.h_nr_running); -unsigned long load_avg =weighted_cpuload (rq); +unsigned long load_avg =cpu_runnable_load (rq);if (nr_running)return load_avg / nr_running;
@@ -5450,7 +5450,7 @@ wake_affine_weight(struct sched_domain *sd, struct task_struct *p,s64 this_eff_load, prev_eff_load;unsigned long task_load; - this_eff_load =weighted_cpuload (cpu_rq (this_cpu)); + this_eff_load =cpu_runnable_load (cpu_rq (this_cpu));if (sync) {unsigned long current_load =task_h_load (current);
@@ -5468,7 +5468,7 @@ wake_affine_weight(struct sched_domain *sd, struct task_struct *p, this_eff_load *=100 ; this_eff_load *=capacity_of (prev_cpu); - prev_eff_load =weighted_cpuload (cpu_rq (prev_cpu)); + prev_eff_load =cpu_runnable_load (cpu_rq (prev_cpu)); prev_eff_load -= task_load;if (sched_feat (WA_BIAS )) prev_eff_load *=100 + (sd->imbalance_pct -100 ) /2 ;
@@ -5556,7 +5556,7 @@ find_idlest_group(struct sched_domain *sd, struct task_struct *p, max_spare_cap =0 ;for_each_cpu (i,sched_group_span (group)) { - load =weighted_cpuload (cpu_rq (i)); + load =cpu_runnable_load (cpu_rq (i)); runnable_load += load; avg_load +=cfs_rq_load_avg (&cpu_rq (i)->cfs);
@@ -5692,7 +5692,7 @@ find_idlest_group_cpu(struct sched_group *group, struct task_struct *p, int this shallowest_idle_cpu = i; } }else if (shallowest_idle_cpu ==-1 ) { - load =weighted_cpuload (cpu_rq (i)); + load =cpu_runnable_load (cpu_rq (i));if (load < min_load) { min_load = load; least_loaded_cpu = i;
@@ -7263,7 +7263,7 @@ static struct task_struct *detach_one_task(struct lb_env *env)static const unsigned int sched_nr_migrate_break =32 ;/* -* detach_tasks() -- tries to detach up to imbalance weighted load from +* detach_tasks() -- tries to detach up to imbalance runnable load from * busiest_rq, as part of a balancing operation within domain "sd". * * Returns number of detached tasks if successful and 0 otherwise.
@@ -7331,7 +7331,7 @@ static int detach_tasks(struct lb_env *env)/* * We only want to steal up to the prescribed amount of -* weighted load. +* runnable load. */ if (env->imbalance <=0 )break ;
@@ -7941,7 +7941,7 @@ static inline void update_sg_lb_stats(struct lb_env *env,if ((env->flags &LBF_NOHZ_STATS ) &&update_nohz_stats (rq, false)) env->flags |=LBF_NOHZ_AGAIN ; - sgs->group_load +=weighted_cpuload (rq); + sgs->group_load +=cpu_runnable_load (rq); sgs->group_util +=cpu_util (i); sgs->sum_nr_running += rq->cfs.h_nr_running;
@@ -8395,7 +8395,7 @@ static inline void calculate_imbalance(struct lb_env *env, struct sd_lb_stats *s* find_busiest_group - Returns the busiest group within the sched_domain * if there is an imbalance. * -* Also calculates the amount of weighted load which should be moved +* Also calculates the amount of runnable load which should be moved * to restore balance. * * @env: The load balancing environment.
@@ -8514,7 +8514,7 @@ static struct rq *find_busiest_queue(struct lb_env *env,int i;for_each_cpu_and (i,sched_group_span (group), env->cpus) { -unsigned long capacity, wl; +unsigned long capacity, load;enum fbq_type rt; rq =cpu_rq (i);
@@ -8568,30 +8568,30 @@ static struct rq *find_busiest_queue(struct lb_env *env, rq->nr_running == 1)continue ; - wl =weighted_cpuload (rq); + load =cpu_runnable_load (rq);/* -* When comparing with imbalance, use weighted_cpuload() +* When comparing with imbalance, use cpu_runnable_load() * which is not scaled with the CPU capacity. */ -if (rq->nr_running ==1 && wl > env->imbalance && +if (rq->nr_running ==1 && load > env->imbalance && !check_cpu_capacity (rq, env->sd))continue ;/* * For the load comparisons with the other CPU's, consider -* the weighted_cpuload() scaled with the CPU capacity, so +* the cpu_runnable_load() scaled with the CPU capacity, so * that the load can be moved away from the CPU that is * potentially running at a lower capacity. * -* Thus we're looking for max(wl_i / capacity_i), crosswise +* Thus we're looking for max(load_i / capacity_i), crosswise * multiplication to rid ourselves of the division works out -* to: wl_i * capacity_j > wl_j * capacity_i; where j is +* to: load_i * capacity_j > load_j * capacity_i; where j is * our previous maximum. */ -if (wl * busiest_capacity > busiest_load * capacity) { - busiest_load = wl; +if (load * busiest_capacity > busiest_load * capacity) { + busiest_load = load; busiest_capacity = capacity; busiest = rq; }
Signature · 1 line
2.17.1
tip-bot for Dietmar Eggemann
merge bot[tip:sched/core] sched/fair: Rename weighted_cpuload() to cpu_runnable_load()
sched/fair: Rename weighted_cpuload() to cpu_runnable_load()
Commit-ID: a3df067974c52df936f548ed218120f623c4c560 Gitweb: https://git.kernel.org/tip/a3df067974c52df936f548ed218120f623c4c560 Author: Dietmar Eggemann <[email protected]> AuthorDate: Tue, 18 Jun 2019 14:23:10 +0200 Committer: Ingo Molnar <[email protected]> CommitDate: Mon, 24 Jun 2019 19:23:43 +0200
sched/fair: Rename weighted_cpuload() to cpu_runnable_load()
The term 'weighted' is not needed since there is no 'unweighted' load. Instead use the term 'runnable' to distinguish 'runnable' load (avg.runnable_load_avg) used in load balance from load (avg.load_avg) which is the sum of 'runnable' and 'blocked' load.
--- kernel/sched/fair.c | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-)
kernel/sched/fair.c +21 -21
@@ -1485,7 +1485,7 @@ bool should_numa_migrate_memory(struct task_struct *p, struct page * page,group_faults_cpu (ng, src_nid) *group_faults (p, dst_nid) *4 ; } -static unsigned long weighted_cpuload (struct rq *rq); +static unsigned long cpu_runnable_load (struct rq *rq);/* Cached statistics for all CPUs within a node */ struct numa_stats {
@@ -1506,7 +1506,7 @@ static void update_numa_stats(struct numa_stats *ns, int nid)for_each_cpu (cpu,cpumask_of_node (nid)) {struct rq *rq =cpu_rq (cpu); - ns->load +=weighted_cpuload (rq); + ns->load +=cpu_runnable_load (rq); ns->compute_capacity +=capacity_of (cpu); }
@@ -5366,7 +5366,7 @@ static struct {#endif /* CONFIG_NO_HZ_COMMON */ -static unsigned long weighted_cpuload (struct rq *rq) +static unsigned long cpu_runnable_load (struct rq *rq) {return cfs_rq_runnable_load_avg (&rq->cfs); }
@@ -5380,7 +5380,7 @@ static unsigned long cpu_avg_load_per_task(int cpu) {struct rq *rq =cpu_rq (cpu);unsigned long nr_running =READ_ONCE (rq->cfs.h_nr_running); -unsigned long load_avg =weighted_cpuload (rq); +unsigned long load_avg =cpu_runnable_load (rq);if (nr_running)return load_avg / nr_running;
@@ -5478,7 +5478,7 @@ wake_affine_weight(struct sched_domain *sd, struct task_struct *p,s64 this_eff_load, prev_eff_load;unsigned long task_load; - this_eff_load =weighted_cpuload (cpu_rq (this_cpu)); + this_eff_load =cpu_runnable_load (cpu_rq (this_cpu));if (sync) {unsigned long current_load =task_h_load (current);
@@ -5496,7 +5496,7 @@ wake_affine_weight(struct sched_domain *sd, struct task_struct *p, this_eff_load *=100 ; this_eff_load *=capacity_of (prev_cpu); - prev_eff_load =weighted_cpuload (cpu_rq (prev_cpu)); + prev_eff_load =cpu_runnable_load (cpu_rq (prev_cpu)); prev_eff_load -= task_load;if (sched_feat (WA_BIAS )) prev_eff_load *=100 + (sd->imbalance_pct -100 ) /2 ;
@@ -5584,7 +5584,7 @@ find_idlest_group(struct sched_domain *sd, struct task_struct *p, max_spare_cap =0 ;for_each_cpu (i,sched_group_span (group)) { - load =weighted_cpuload (cpu_rq (i)); + load =cpu_runnable_load (cpu_rq (i)); runnable_load += load; avg_load +=cfs_rq_load_avg (&cpu_rq (i)->cfs);
@@ -5720,7 +5720,7 @@ find_idlest_group_cpu(struct sched_group *group, struct task_struct *p, int this shallowest_idle_cpu = i; } }else if (shallowest_idle_cpu ==-1 ) { - load =weighted_cpuload (cpu_rq (i)); + load =cpu_runnable_load (cpu_rq (i));if (load < min_load) { min_load = load; least_loaded_cpu = i;
@@ -7291,7 +7291,7 @@ static struct task_struct *detach_one_task(struct lb_env *env)static const unsigned int sched_nr_migrate_break =32 ;/* -* detach_tasks() -- tries to detach up to imbalance weighted load from +* detach_tasks() -- tries to detach up to imbalance runnable load from * busiest_rq, as part of a balancing operation within domain "sd". * * Returns number of detached tasks if successful and 0 otherwise.
@@ -7359,7 +7359,7 @@ static int detach_tasks(struct lb_env *env)/* * We only want to steal up to the prescribed amount of -* weighted load. +* runnable load. */ if (env->imbalance <=0 )break ;
@@ -7969,7 +7969,7 @@ static inline void update_sg_lb_stats(struct lb_env *env,if ((env->flags &LBF_NOHZ_STATS ) &&update_nohz_stats (rq, false)) env->flags |=LBF_NOHZ_AGAIN ; - sgs->group_load +=weighted_cpuload (rq); + sgs->group_load +=cpu_runnable_load (rq); sgs->group_util +=cpu_util (i); sgs->sum_nr_running += rq->cfs.h_nr_running;
@@ -8427,7 +8427,7 @@ static inline void calculate_imbalance(struct lb_env *env, struct sd_lb_stats *s* find_busiest_group - Returns the busiest group within the sched_domain * if there is an imbalance. * -* Also calculates the amount of weighted load which should be moved +* Also calculates the amount of runnable load which should be moved * to restore balance. * * @env: The load balancing environment.
@@ -8546,7 +8546,7 @@ static struct rq *find_busiest_queue(struct lb_env *env,int i;for_each_cpu_and (i,sched_group_span (group), env->cpus) { -unsigned long capacity, wl; +unsigned long capacity, load;enum fbq_type rt; rq =cpu_rq (i);
@@ -8600,30 +8600,30 @@ static struct rq *find_busiest_queue(struct lb_env *env, rq->nr_running == 1)continue ; - wl =weighted_cpuload (rq); + load =cpu_runnable_load (rq);/* -* When comparing with imbalance, use weighted_cpuload() +* When comparing with imbalance, use cpu_runnable_load() * which is not scaled with the CPU capacity. */ -if (rq->nr_running ==1 && wl > env->imbalance && +if (rq->nr_running ==1 && load > env->imbalance && !check_cpu_capacity (rq, env->sd))continue ;/* * For the load comparisons with the other CPU's, consider -* the weighted_cpuload() scaled with the CPU capacity, so +* the cpu_runnable_load() scaled with the CPU capacity, so * that the load can be moved away from the CPU that is * potentially running at a lower capacity. * -* Thus we're looking for max(wl_i / capacity_i), crosswise +* Thus we're looking for max(load_i / capacity_i), crosswise * multiplication to rid ourselves of the division works out -* to: wl_i * capacity_j > wl_j * capacity_i; where j is +* to: load_i * capacity_j > load_j * capacity_i; where j is * our previous maximum. */ -if (wl * busiest_capacity > busiest_load * capacity) { - busiest_load = wl; +if (load * busiest_capacity > busiest_load * capacity) { + busiest_load = load; busiest_capacity = capacity; busiest = rq; }