sched: cleanup trigger_load_balance
v2 cover sched: cleanup trigger_load_balance
This patchset does a cleanup on the parameters passed from the function 'trigger_load_balance' to the underneath functions.
The cpu is passed as parameter to the different functions as well as the struct rq but this one contains already the cpu information. Moreover, in the call stack for these functions, we have the struct rq retrieved from the cpu, and then the cpu retrieve from the struct rq, etc ...
The patchset unifies all these functions to have a struct rq parameter and removes the pointless parameters.
-static inline int find_new_ilb(int call_cpu)
+static inline int find_new_ilb(void)
-static void nohz_balancer_kick(int cpu)
+static void nohz_balancer_kick(void)
-static void rebalance_domains(int cpu, enum cpu_idle_type idle) +static void rebalance_domains(struct rq *rq, enum cpu_idle_type idle)
-static void nohz_idle_balance(int this_cpu, enum cpu_idle_type idle) +static void nohz_idle_balance(struct rq *this_rq, enum cpu_idle_type idle)
-static inline int nohz_kick_needed(struct rq *rq, int cpu) +static inline int nohz_kick_needed(struct rq *rq)
-static inline int on_null_domain(int cpu)
+static inline int on_null_domain(struct rq *rq)
Changelog:
V2:
- added missing patch 1/8
- added acked-by from Preeti U Murthy for patch 4 and 5
Daniel Lezcano (8):
sched: reduce trigger_load_balance parameters
sched: reduce nohz_kick_needed parameters
sched: pass struct rq to on_null_domain function
sched: remove unused parameter for find_new_ilb
sched: remove unused parameter in nohz_balancer_kick function
sched: pass struct rq to rebalance_domains function
sched: pass struct rq to nohz_idle_balance function
sched: factor out on_null_domain check in trigger_load_balance
function
kernel/sched/core.c | 2 +- kernel/sched/fair.c | 45 +++++++++++++++++++++++---------------------- kernel/sched/sched.h | 2 +- 3 files changed, 25 insertions(+), 24 deletions(-)
Signature · 1 line
1.7.9.5
PATCH v2 1/8 sched: reduce trigger_load_balance parameters
The cpu information is already stored in the struct rq, so no need to pass it as parameter to the trigger_load_balance function.
--- kernel/sched/core.c | 2 +- kernel/sched/fair.c | 4 +++- kernel/sched/sched.h | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-)
kernel/sched/core.c +1 -1
@@ -2299,7 +2299,7 @@ void scheduler_tick(void)#ifdef CONFIG_SMP rq->idle_balance =idle_cpu (cpu); -trigger_load_balance (rq, cpu); +trigger_load_balance (rq);#endif rq_last_tick_reset (rq); }
kernel/sched/fair.c +3 -1
@@ -6869,8 +6869,10 @@ static inline int on_null_domain(int cpu)/* * Trigger the SCHED_SOFTIRQ if it is time to do periodic load balancing. */ -void trigger_load_balance (struct rq *rq,int cpu) +void trigger_load_balance (struct rq *rq) { +int cpu = rq->cpu; +/* Don't need to rebalance while attached to NULL domain */ if (time_after_eq (jiffies, rq->next_balance) &&likely (!on_null_domain (cpu)))
kernel/sched/sched.h +1 -1
@@ -1052,7 +1052,7 @@ extern const struct sched_class idle_sched_class;extern void update_group_power (struct sched_domain *sd,int cpu); -extern void trigger_load_balance (struct rq *rq,int cpu); +extern void trigger_load_balance (struct rq *rq);extern void idle_balance (int this_cpu,struct rq *this_rq);extern void idle_enter_fair (struct rq *this_rq);
Signature · 1 line
1.7.9.5
tip-bot for Daniel Lezcano
merge bot[tip:sched/core] sched: Reduce trigger_load_balance() parameters
sched: Reduce trigger_load_balance() parameters
Commit-ID: 7caff66f361c44d0fbc74ed1cfa60a357fc84cf2 Gitweb: http://git.kernel.org/tip/7caff66f361c44d0fbc74ed1cfa60a357fc84cf2 Author: Daniel Lezcano <[email protected]> AuthorDate: Mon, 6 Jan 2014 12:34:38 +0100 Committer: Ingo Molnar <[email protected]> CommitDate: Mon, 13 Jan 2014 13:47:26 +0100
sched: Reduce trigger_load_balance() parameters
The cpu information is already stored in the struct rq, so no need to pass it as parameter to the trigger_load_balance function.
--- kernel/sched/core.c | 2 +- kernel/sched/fair.c | 4 +++- kernel/sched/sched.h | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-)
kernel/sched/core.c +1 -1
@@ -2436,7 +2436,7 @@ void scheduler_tick(void)#ifdef CONFIG_SMP rq->idle_balance =idle_cpu (cpu); -trigger_load_balance (rq, cpu); +trigger_load_balance (rq);#endif rq_last_tick_reset (rq); }
kernel/sched/fair.c +3 -1
@@ -6876,8 +6876,10 @@ static inline int on_null_domain(int cpu)/* * Trigger the SCHED_SOFTIRQ if it is time to do periodic load balancing. */ -void trigger_load_balance (struct rq *rq,int cpu) +void trigger_load_balance (struct rq *rq) { +int cpu = rq->cpu; +/* Don't need to rebalance while attached to NULL domain */ if (time_after_eq (jiffies, rq->next_balance) &&likely (!on_null_domain (cpu)))
kernel/sched/sched.h +1 -1
@@ -1175,7 +1175,7 @@ extern const struct sched_class idle_sched_class;extern void update_group_power (struct sched_domain *sd,int cpu); -extern void trigger_load_balance (struct rq *rq,int cpu); +extern void trigger_load_balance (struct rq *rq);extern void idle_balance (int this_cpu,struct rq *this_rq);extern void idle_enter_fair (struct rq *this_rq);
PATCH v2 2/8 sched: reduce nohz_kick_needed parameters
In reply to Daniel LezcanoThe cpu information is already stored in the struct rq, so no need to pass it as parameter to the nohz_kick_needed function.
The caller of this function just called idle_cpu() before to fill the rq->idle_balance field.
Use rq->cpu and rq->idle_balance.
--- kernel/sched/fair.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
kernel/sched/fair.c +4 -4
@@ -6781,14 +6781,14 @@ end:* - For SD_ASYM_PACKING, if the lower numbered cpu's in the scheduler * domain span are idle. */ -static inline int nohz_kick_needed (struct rq *rq,int cpu) +static inline int nohz_kick_needed (struct rq *rq) {unsigned long now = jiffies;struct sched_domain *sd;struct sched_group_power *sgp; -int nr_busy; +int nr_busy, cpu = rq->cpu; -if (unlikely (idle_cpu (cpu))) +if (unlikely (rq->idle_balance))return 0 ;/*
@@ -6878,7 +6878,7 @@ void trigger_load_balance(struct rq *rq) likely(!on_null_domain(cpu)))raise_softirq (SCHED_SOFTIRQ );#ifdef CONFIG_NO_HZ_COMMON -if (nohz_kick_needed (rq, cpu) &&likely (!on_null_domain (cpu))) +if (nohz_kick_needed (rq) &&likely (!on_null_domain (cpu)))nohz_balancer_kick (cpu);#endif }
Signature · 1 line
1.7.9.5
tip-bot for Daniel Lezcano
merge bot[tip:sched/core] sched: Reduce nohz_kick_needed() parameters
sched: Reduce nohz_kick_needed() parameters
Commit-ID: 4a725627f21df6b280a19f50bc849daaab3b1544 Gitweb: http://git.kernel.org/tip/4a725627f21df6b280a19f50bc849daaab3b1544 Author: Daniel Lezcano <[email protected]> AuthorDate: Mon, 6 Jan 2014 12:34:39 +0100 Committer: Ingo Molnar <[email protected]> CommitDate: Mon, 13 Jan 2014 13:47:27 +0100
sched: Reduce nohz_kick_needed() parameters
The cpu information is already stored in the struct rq, so no need to pass it as parameter to the nohz_kick_needed function.
The caller of this function just called idle_cpu() before to fill the rq->idle_balance field.
Use rq->cpu and rq->idle_balance.
--- kernel/sched/fair.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
kernel/sched/fair.c +4 -4
@@ -6788,14 +6788,14 @@ end:* - For SD_ASYM_PACKING, if the lower numbered cpu's in the scheduler * domain span are idle. */ -static inline int nohz_kick_needed (struct rq *rq,int cpu) +static inline int nohz_kick_needed (struct rq *rq) {unsigned long now = jiffies;struct sched_domain *sd;struct sched_group_power *sgp; -int nr_busy; +int nr_busy, cpu = rq->cpu; -if (unlikely (idle_cpu (cpu))) +if (unlikely (rq->idle_balance))return 0 ;/*
@@ -6885,7 +6885,7 @@ void trigger_load_balance(struct rq *rq) likely(!on_null_domain(cpu)))raise_softirq (SCHED_SOFTIRQ );#ifdef CONFIG_NO_HZ_COMMON -if (nohz_kick_needed (rq, cpu) &&likely (!on_null_domain (cpu))) +if (nohz_kick_needed (rq) &&likely (!on_null_domain (cpu)))nohz_balancer_kick (cpu);#endif }
PATCH v2 3/8 sched: pass struct rq to on_null_domain function
In reply to Daniel LezcanoThe on_null_domain function is getting the cpu to retrieve the struct rq associated with it.
Pass the struct rq directly to the function as the caller has already the info.
--- kernel/sched/fair.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
kernel/sched/fair.c +4 -4
@@ -6861,9 +6861,9 @@ static void run_rebalance_domains(struct softirq_action *h)nohz_idle_balance (this_cpu, idle); } -static inline int on_null_domain (int cpu) +static inline int on_null_domain (struct rq *rq) { -return !rcu_dereference_sched (cpu_rq (cpu)->sd); +return !rcu_dereference_sched (rq->sd); }/*
@@ -6875,10 +6875,10 @@ void trigger_load_balance(struct rq *rq)/* Don't need to rebalance while attached to NULL domain */ if (time_after_eq (jiffies, rq->next_balance) && -likely (!on_null_domain (cpu))) +likely (!on_null_domain (rq)))raise_softirq (SCHED_SOFTIRQ );#ifdef CONFIG_NO_HZ_COMMON -if (nohz_kick_needed (rq) &&likely (!on_null_domain (cpu))) +if (nohz_kick_needed (rq) &&likely (!on_null_domain (rq)))nohz_balancer_kick (cpu);#endif }
Signature · 1 line
1.7.9.5
tip-bot for Daniel Lezcano
merge bot[tip:sched/core] sched: Pass 'struct rq' to on_null_domain()
sched: Pass 'struct rq' to on_null_domain()
Commit-ID: 63f609b160151c9e86b26b935c9671a23afe299f Gitweb: http://git.kernel.org/tip/63f609b160151c9e86b26b935c9671a23afe299f Author: Daniel Lezcano <[email protected]> AuthorDate: Mon, 6 Jan 2014 12:34:40 +0100 Committer: Ingo Molnar <[email protected]> CommitDate: Mon, 13 Jan 2014 13:47:28 +0100
sched: Pass 'struct rq' to on_null_domain()
The on_null_domain() function is getting the cpu to retrieve the struct rq associated with it.
Pass 'struct rq' directly to the function as the caller already has the info.
--- kernel/sched/fair.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
kernel/sched/fair.c +4 -4
@@ -6868,9 +6868,9 @@ static void run_rebalance_domains(struct softirq_action *h)nohz_idle_balance (this_cpu, idle); } -static inline int on_null_domain (int cpu) +static inline int on_null_domain (struct rq *rq) { -return !rcu_dereference_sched (cpu_rq (cpu)->sd); +return !rcu_dereference_sched (rq->sd); }/*
@@ -6882,10 +6882,10 @@ void trigger_load_balance(struct rq *rq)/* Don't need to rebalance while attached to NULL domain */ if (time_after_eq (jiffies, rq->next_balance) && -likely (!on_null_domain (cpu))) +likely (!on_null_domain (rq)))raise_softirq (SCHED_SOFTIRQ );#ifdef CONFIG_NO_HZ_COMMON -if (nohz_kick_needed (rq) &&likely (!on_null_domain (cpu))) +if (nohz_kick_needed (rq) &&likely (!on_null_domain (rq)))nohz_balancer_kick (cpu);#endif }
PATCH v2 4/8 sched: remove unused parameter for find_new_ilb
In reply to Daniel LezcanoThe 'call_cpu' is never used in the function. Remove it.
--- kernel/sched/fair.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/sched/fair.c +2 -2
@@ -6502,7 +6502,7 @@ static struct {unsigned long next_balance;/* in jiffy units */ } nohz____cacheline_aligned ; -static inline int find_new_ilb (int call_cpu) +static inline int find_new_ilb (void ) {int ilb =cpumask_first (nohz.idle_cpus_mask);
@@ -6523,7 +6523,7 @@ static void nohz_balancer_kick(int cpu) nohz.next_balance++; - ilb_cpu =find_new_ilb (cpu); + ilb_cpu =find_new_ilb ();if (ilb_cpu >= nr_cpu_ids)return ;
Signature · 1 line
1.7.9.5
tip-bot for Daniel Lezcano
merge bot[tip:sched/core] sched: Remove unused parameter from find_new_ilb ()
sched: Remove unused parameter from find_new_ilb()
Commit-ID: 3dd0337d6df7d54c82ecebfa6485040f686bf8b1 Gitweb: http://git.kernel.org/tip/3dd0337d6df7d54c82ecebfa6485040f686bf8b1 Author: Daniel Lezcano <[email protected]> AuthorDate: Mon, 6 Jan 2014 12:34:41 +0100 Committer: Ingo Molnar <[email protected]> CommitDate: Mon, 13 Jan 2014 13:47:29 +0100
sched: Remove unused parameter from find_new_ilb()
The 'call_cpu' is never used in the function. Remove it.
--- kernel/sched/fair.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/sched/fair.c +2 -2
@@ -6509,7 +6509,7 @@ static struct {unsigned long next_balance;/* in jiffy units */ } nohz____cacheline_aligned ; -static inline int find_new_ilb (int call_cpu) +static inline int find_new_ilb (void ) {int ilb =cpumask_first (nohz.idle_cpus_mask);
@@ -6530,7 +6530,7 @@ static void nohz_balancer_kick(int cpu) nohz.next_balance++; - ilb_cpu =find_new_ilb (cpu); + ilb_cpu =find_new_ilb ();if (ilb_cpu >= nr_cpu_ids)return ;
PATCH v2 5/8 sched: remove unused parameter in nohz_balancer_kick function
In reply to Daniel LezcanoThe cpu parameter is no longer needed in nohz_balancer_kick, let's remove the parameter.
--- kernel/sched/fair.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
kernel/sched/fair.c +2 -4
@@ -6517,7 +6517,7 @@ static inline int find_new_ilb(void)* nohz_load_balancer CPU (if there is one) otherwise fallback to any idle * CPU (if there is one). */ -static void nohz_balancer_kick (int cpu) +static void nohz_balancer_kick (void ) {int ilb_cpu;
@@ -6871,15 +6871,13 @@ static inline int on_null_domain(struct rq *rq)*/ void trigger_load_balance (struct rq *rq) { -int cpu = rq->cpu; -/* Don't need to rebalance while attached to NULL domain */ if (time_after_eq (jiffies, rq->next_balance) &&likely (!on_null_domain (rq)))raise_softirq (SCHED_SOFTIRQ );#ifdef CONFIG_NO_HZ_COMMON if (nohz_kick_needed (rq) &&likely (!on_null_domain (rq))) -nohz_balancer_kick (cpu); +nohz_balancer_kick ();#endif }
Signature · 1 line
1.7.9.5
tip-bot for Daniel Lezcano
merge bot[tip:sched/core] sched: Remove unused parameter from nohz_balancer_kick()
sched: Remove unused parameter from nohz_balancer_kick()
Commit-ID: 0aeeeebac8d8304501680f12862784341f4bee7b Gitweb: http://git.kernel.org/tip/0aeeeebac8d8304501680f12862784341f4bee7b Author: Daniel Lezcano <[email protected]> AuthorDate: Mon, 6 Jan 2014 12:34:42 +0100 Committer: Ingo Molnar <[email protected]> CommitDate: Mon, 13 Jan 2014 13:47:30 +0100
sched: Remove unused parameter from nohz_balancer_kick()
The cpu parameter is no longer needed in nohz_balancer_kick, let's remove the parameter.
--- kernel/sched/fair.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
kernel/sched/fair.c +2 -4
@@ -6524,7 +6524,7 @@ static inline int find_new_ilb(void)* nohz_load_balancer CPU (if there is one) otherwise fallback to any idle * CPU (if there is one). */ -static void nohz_balancer_kick (int cpu) +static void nohz_balancer_kick (void ) {int ilb_cpu;
@@ -6878,15 +6878,13 @@ static inline int on_null_domain(struct rq *rq)*/ void trigger_load_balance (struct rq *rq) { -int cpu = rq->cpu; -/* Don't need to rebalance while attached to NULL domain */ if (time_after_eq (jiffies, rq->next_balance) &&likely (!on_null_domain (rq)))raise_softirq (SCHED_SOFTIRQ );#ifdef CONFIG_NO_HZ_COMMON if (nohz_kick_needed (rq) &&likely (!on_null_domain (rq))) -nohz_balancer_kick (cpu); +nohz_balancer_kick ();#endif }
PATCH v2 6/8 sched: pass struct rq to rebalance_domains function
In reply to Daniel LezcanoThe cpu information is stored in the struct rq and the caller of the rebalance_domains function pass the cpu to retrieve the struct rq but it already has the struct rq info. Replace the cpu parameter with the struct rq.
--- kernel/sched/fair.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
kernel/sched/fair.c +4 -4
@@ -6633,10 +6633,10 @@ void update_max_interval(void)* * Balancing parameters are set up in init_sched_domains. */ -static void rebalance_domains (int cpu,enum cpu_idle_type idle) +static void rebalance_domains (struct rq *rq,enum cpu_idle_type idle) {int continue_balancing =1 ; -struct rq *rq =cpu_rq (cpu); +int cpu = rq->cpu;unsigned long interval;struct sched_domain *sd;/* Earliest time when we have to do rebalance again */
@@ -6762,7 +6762,7 @@ static void nohz_idle_balance(int this_cpu, enum cpu_idle_type idle)update_idle_cpu_load (rq);raw_spin_unlock_irq (&rq->lock); -rebalance_domains (balance_cpu,CPU_IDLE ); +rebalance_domains (rq,CPU_IDLE );if (time_after (this_rq->next_balance, rq->next_balance)) this_rq->next_balance = rq->next_balance;
@@ -6851,7 +6851,7 @@ static void run_rebalance_domains(struct softirq_action *h)enum cpu_idle_type idle = this_rq->idle_balance ?CPU_IDLE :CPU_NOT_IDLE ; -rebalance_domains (this_cpu, idle); +rebalance_domains (this_rq, idle);/* * If this cpu has a pending nohz_balance_kick, then do the
Signature · 1 line
1.7.9.5
tip-bot for Daniel Lezcano
merge bot[tip:sched/core] sched: Pass 'struct rq' to rebalance_domains()
sched: Pass 'struct rq' to rebalance_domains()
Commit-ID: f7ed0a895ead0f093f59898ff9cf4e20768a5f09 Gitweb: http://git.kernel.org/tip/f7ed0a895ead0f093f59898ff9cf4e20768a5f09 Author: Daniel Lezcano <[email protected]> AuthorDate: Mon, 6 Jan 2014 12:34:43 +0100 Committer: Ingo Molnar <[email protected]> CommitDate: Mon, 13 Jan 2014 13:47:31 +0100
sched: Pass 'struct rq' to rebalance_domains()
The cpu information is stored in the struct rq and the caller of the rebalance_domains function pass the cpu to retrieve the struct rq but it already has the struct rq info. Replace the cpu parameter with the struct rq.
--- kernel/sched/fair.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
kernel/sched/fair.c +4 -4
@@ -6640,10 +6640,10 @@ void update_max_interval(void)* * Balancing parameters are set up in init_sched_domains. */ -static void rebalance_domains (int cpu,enum cpu_idle_type idle) +static void rebalance_domains (struct rq *rq,enum cpu_idle_type idle) {int continue_balancing =1 ; -struct rq *rq =cpu_rq (cpu); +int cpu = rq->cpu;unsigned long interval;struct sched_domain *sd;/* Earliest time when we have to do rebalance again */
@@ -6769,7 +6769,7 @@ static void nohz_idle_balance(int this_cpu, enum cpu_idle_type idle)update_idle_cpu_load (rq);raw_spin_unlock_irq (&rq->lock); -rebalance_domains (balance_cpu,CPU_IDLE ); +rebalance_domains (rq,CPU_IDLE );if (time_after (this_rq->next_balance, rq->next_balance)) this_rq->next_balance = rq->next_balance;
@@ -6858,7 +6858,7 @@ static void run_rebalance_domains(struct softirq_action *h)enum cpu_idle_type idle = this_rq->idle_balance ?CPU_IDLE :CPU_NOT_IDLE ; -rebalance_domains (this_cpu, idle); +rebalance_domains (this_rq, idle);/* * If this cpu has a pending nohz_balance_kick, then do the
PATCH v2 7/8 sched: pass struct rq to nohz_idle_balance function
In reply to Daniel LezcanoThe cpu information is stored in the struct rq. Pass the struct rq to nohz_idle_balance, so all the functions called in run_rebalance_domains have the same parameters and the 'this_cpu' variable becomes pointless.
--- kernel/sched/fair.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
kernel/sched/fair.c +4 -5
@@ -6733,9 +6733,9 @@ out:* In CONFIG_NO_HZ_COMMON case, the idle balance kickee will do the * rebalancing for all the cpus for whom scheduler ticks are stopped. */ -static void nohz_idle_balance (int this_cpu,enum cpu_idle_type idle) +static void nohz_idle_balance (struct rq *this_rq,enum cpu_idle_type idle) { -struct rq *this_rq =cpu_rq (this_cpu); +int this_cpu = this_rq->cpu;struct rq *rq;int balance_cpu;
@@ -6846,8 +6846,7 @@ static void nohz_idle_balance(int this_cpu, enum cpu_idle_type idle) { }*/ static void run_rebalance_domains (struct softirq_action *h) { -int this_cpu =smp_processor_id (); -struct rq *this_rq =cpu_rq (this_cpu); +struct rq *this_rq =this_rq ();enum cpu_idle_type idle = this_rq->idle_balance ?CPU_IDLE :CPU_NOT_IDLE ;
@@ -6858,7 +6857,7 @@ static void run_rebalance_domains(struct softirq_action *h)* balancing on behalf of the other idle cpus whose ticks are * stopped. */ -nohz_idle_balance (this_cpu, idle); +nohz_idle_balance (this_rq, idle); }static inline int on_null_domain (struct rq *rq)
Signature · 1 line
1.7.9.5
tip-bot for Daniel Lezcano
merge bot[tip:sched/core] sched: Pass 'struct rq' to nohz_idle_balance()
sched: Pass 'struct rq' to nohz_idle_balance()
Commit-ID: 208cb16ba325552a3935bfc002e34561b0d512d7 Gitweb: http://git.kernel.org/tip/208cb16ba325552a3935bfc002e34561b0d512d7 Author: Daniel Lezcano <[email protected]> AuthorDate: Mon, 6 Jan 2014 12:34:44 +0100 Committer: Ingo Molnar <[email protected]> CommitDate: Mon, 13 Jan 2014 13:47:33 +0100
sched: Pass 'struct rq' to nohz_idle_balance()
The cpu information is stored in the struct rq. Pass the struct rq to nohz_idle_balance, so all the functions called in run_rebalance_domains have the same parameters and the 'this_cpu' variable becomes pointless.
--- kernel/sched/fair.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
kernel/sched/fair.c +5 -6
@@ -6740,9 +6740,9 @@ out:* In CONFIG_NO_HZ_COMMON case, the idle balance kickee will do the * rebalancing for all the cpus for whom scheduler ticks are stopped. */ -static void nohz_idle_balance (int this_cpu,enum cpu_idle_type idle) +static void nohz_idle_balance (struct rq *this_rq,enum cpu_idle_type idle) { -struct rq *this_rq =cpu_rq (this_cpu); +int this_cpu = this_rq->cpu;struct rq *rq;int balance_cpu;
@@ -6844,7 +6844,7 @@ need_kick: return 1; }#else -static void nohz_idle_balance (int this_cpu,enum cpu_idle_type idle) { } +static void nohz_idle_balance (struct rq *this_rq,enum cpu_idle_type idle) { }#endif /*
@@ -6853,8 +6853,7 @@ static void nohz_idle_balance(int this_cpu, enum cpu_idle_type idle) { }*/ static void run_rebalance_domains (struct softirq_action *h) { -int this_cpu =smp_processor_id (); -struct rq *this_rq =cpu_rq (this_cpu); +struct rq *this_rq =this_rq ();enum cpu_idle_type idle = this_rq->idle_balance ?CPU_IDLE :CPU_NOT_IDLE ;
@@ -6865,7 +6864,7 @@ static void run_rebalance_domains(struct softirq_action *h)* balancing on behalf of the other idle cpus whose ticks are * stopped. */ -nohz_idle_balance (this_cpu, idle); +nohz_idle_balance (this_rq, idle); }static inline int on_null_domain (struct rq *rq)
PATCH v2 8/8 sched: factor out on_null_domain check in trigger_load_balance function
In reply to Daniel LezcanoThe test on_null_domain is done twice in the trigger_load_balance function.
Move the test at the begin of the function, so there is only one check.
--- kernel/sched/fair.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
kernel/sched/fair.c +5 -3
@@ -6871,11 +6871,13 @@ static inline int on_null_domain(struct rq *rq)void trigger_load_balance (struct rq *rq) {/* Don't need to rebalance while attached to NULL domain */ -if (time_after_eq (jiffies, rq->next_balance) && -likely (!on_null_domain (rq))) +if (unlikely (on_null_domain (rq))) +return ; + +if (time_after_eq (jiffies, rq->next_balance))raise_softirq (SCHED_SOFTIRQ );#ifdef CONFIG_NO_HZ_COMMON -if (nohz_kick_needed (rq) &&likely (!on_null_domain (rq))) +if (nohz_kick_needed (rq))nohz_balancer_kick ();#endif }
Signature · 1 line
1.7.9.5
tip-bot for Daniel Lezcano
merge bot[tip:sched/core] sched: Factor out the on_null_domain() checks in trigger_load_balance()
sched: Factor out the on_null_domain() checks in trigger_load_balance()
Commit-ID: c726099ec224be8078d91072207053ff9a1ad6fc Gitweb: http://git.kernel.org/tip/c726099ec224be8078d91072207053ff9a1ad6fc Author: Daniel Lezcano <[email protected]> AuthorDate: Mon, 6 Jan 2014 12:34:45 +0100 Committer: Ingo Molnar <[email protected]> CommitDate: Mon, 13 Jan 2014 13:47:35 +0100
sched: Factor out the on_null_domain() checks in trigger_load_balance()
The test on_null_domain is done twice in the trigger_load_balance function.
Move the test at the begin of the function, so there is only one check.
--- kernel/sched/fair.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
kernel/sched/fair.c +5 -3
@@ -6878,11 +6878,13 @@ static inline int on_null_domain(struct rq *rq)void trigger_load_balance (struct rq *rq) {/* Don't need to rebalance while attached to NULL domain */ -if (time_after_eq (jiffies, rq->next_balance) && -likely (!on_null_domain (rq))) +if (unlikely (on_null_domain (rq))) +return ; + +if (time_after_eq (jiffies, rq->next_balance))raise_softirq (SCHED_SOFTIRQ );#ifdef CONFIG_NO_HZ_COMMON -if (nohz_kick_needed (rq) &&likely (!on_null_domain (rq))) +if (nohz_kick_needed (rq))nohz_balancer_kick ();#endif }
Peter Zijlstra
maintainerQuoted 2 lines · Daniel Lezcano
This patchset does a cleanup on the parameters passed from the function '
trigger_load_balance' to the underneath functions.
Whee.. it applies ;-)
Quoted 5 lines · Peter Zijlstra
Quoted 2 lines · Daniel Lezcano
This patchset does a cleanup on the parameters passed from the function '
trigger_load_balance' to the underneath functions.Whee.. it applies ;-)
Hi Peter,
do you consider it for upstream ?
Thanks
-- Daniel
Signature · 5 lines
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook | <http://twitter.com/#!/linaroorg> Twitter | <http://www.linaro.org/linaro-blog/> Blog