* [PATCH 1/2] nohz: clean up select_nohz_load_balancer()
@ 2012-09-10 7:10 Alex Shi
2012-09-10 7:10 ` [PATCH 2/2] sched: trigger_load_balance clean up Alex Shi
` (2 more replies)
0 siblings, 3 replies; 10+ messages in thread
From: Alex Shi @ 2012-09-10 7:10 UTC (permalink / raw)
To: mingo, peterz, tglx; +Cc: linux-kernel
There is no load_balancer to be selected now. It just set state of
nohz tick stopping.
So rename the function, pass the 'cpu' from parameter and then
remove the useless calling from tick_nohz_restart_sched_tick().
Signed-off-by: Alex Shi <alex.shi@intel.com>
---
include/linux/sched.h | 4 ++--
kernel/sched/fair.c | 19 +++++++------------
kernel/time/tick-sched.c | 3 +--
3 files changed, 10 insertions(+), 16 deletions(-)
diff --git a/include/linux/sched.h b/include/linux/sched.h
index b8c8664..5cba49c 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -273,11 +273,11 @@ extern void init_idle_bootup_task(struct task_struct *idle);
extern int runqueue_is_locked(int cpu);
#if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ)
-extern void select_nohz_load_balancer(int stop_tick);
+extern void set_nohz_tick_stopped(int cpu);
extern void set_cpu_sd_state_idle(void);
extern int get_nohz_timer_target(void);
#else
-static inline void select_nohz_load_balancer(int stop_tick) { }
+static inline void set_nohz_tick_stopped(int cpu) { }
static inline void set_cpu_sd_state_idle(void) { }
#endif
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index c219bf8..5bbc4bf 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -4674,28 +4674,23 @@ void set_cpu_sd_state_idle(void)
}
/*
- * This routine will record that this cpu is going idle with tick stopped.
+ * This routine will record that the cpu is going idle with tick stopped.
* This info will be used in performing idle load balancing in the future.
*/
-void select_nohz_load_balancer(int stop_tick)
+void set_nohz_tick_stopped(int cpu)
{
- int cpu = smp_processor_id();
-
/*
* If this cpu is going down, then nothing needs to be done.
*/
if (!cpu_active(cpu))
return;
- if (stop_tick) {
- if (test_bit(NOHZ_TICK_STOPPED, nohz_flags(cpu)))
- return;
+ if (test_bit(NOHZ_TICK_STOPPED, nohz_flags(cpu)))
+ return;
- cpumask_set_cpu(cpu, nohz.idle_cpus_mask);
- atomic_inc(&nohz.nr_cpus);
- set_bit(NOHZ_TICK_STOPPED, nohz_flags(cpu));
- }
- return;
+ cpumask_set_cpu(cpu, nohz.idle_cpus_mask);
+ atomic_inc(&nohz.nr_cpus);
+ set_bit(NOHZ_TICK_STOPPED, nohz_flags(cpu));
}
static int __cpuinit sched_ilb_notifier(struct notifier_block *nfb,
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
index 024540f..eacde97 100644
--- a/kernel/time/tick-sched.c
+++ b/kernel/time/tick-sched.c
@@ -372,7 +372,7 @@ static ktime_t tick_nohz_stop_sched_tick(struct tick_sched *ts,
* the scheduler tick in nohz_restart_sched_tick.
*/
if (!ts->tick_stopped) {
- select_nohz_load_balancer(1);
+ set_nohz_tick_stopped(cpu);
calc_load_enter_idle();
ts->last_tick = hrtimer_get_expires(&ts->sched_timer);
@@ -569,7 +569,6 @@ static void tick_nohz_restart(struct tick_sched *ts, ktime_t now)
static void tick_nohz_restart_sched_tick(struct tick_sched *ts, ktime_t now)
{
/* Update jiffies first */
- select_nohz_load_balancer(0);
tick_do_update_jiffies64(now);
update_cpu_load_nohz();
--
1.7.5.4
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 2/2] sched: trigger_load_balance clean up
2012-09-10 7:10 [PATCH 1/2] nohz: clean up select_nohz_load_balancer() Alex Shi
@ 2012-09-10 7:10 ` Alex Shi
2012-09-11 18:36 ` Suresh Siddha
2012-09-10 15:26 ` [PATCH 1/2] nohz: clean up select_nohz_load_balancer() Peter Zijlstra
2012-09-14 6:15 ` [tip:sched/core] sched/nohz: Clean " tip-bot for Alex Shi
2 siblings, 1 reply; 10+ messages in thread
From: Alex Shi @ 2012-09-10 7:10 UTC (permalink / raw)
To: mingo, peterz, tglx; +Cc: linux-kernel
Remove a redundant check for on_null_domain(cpu), and rerange the code
that make it more readable.
Signed-off-by: Alex Shi <alex.shi@intel.com>
---
kernel/sched/fair.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 5bbc4bf..529092d 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -4934,11 +4934,13 @@ static inline int on_null_domain(int cpu)
void trigger_load_balance(struct rq *rq, int cpu)
{
/* Don't need to rebalance while attached to NULL domain */
- if (time_after_eq(jiffies, rq->next_balance) &&
- likely(!on_null_domain(cpu)))
+ if (unlikely(on_null_domain(cpu)))
+ return;
+
+ if (time_after_eq(jiffies, rq->next_balance))
raise_softirq(SCHED_SOFTIRQ);
#ifdef CONFIG_NO_HZ
- if (nohz_kick_needed(rq, cpu) && likely(!on_null_domain(cpu)))
+ if (nohz_kick_needed(rq, cpu))
nohz_balancer_kick(cpu);
#endif
}
--
1.7.5.4
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 1/2] nohz: clean up select_nohz_load_balancer()
2012-09-10 7:10 [PATCH 1/2] nohz: clean up select_nohz_load_balancer() Alex Shi
2012-09-10 7:10 ` [PATCH 2/2] sched: trigger_load_balance clean up Alex Shi
@ 2012-09-10 15:26 ` Peter Zijlstra
2012-09-11 1:27 ` Alex Shi
2012-09-14 6:15 ` [tip:sched/core] sched/nohz: Clean " tip-bot for Alex Shi
2 siblings, 1 reply; 10+ messages in thread
From: Peter Zijlstra @ 2012-09-10 15:26 UTC (permalink / raw)
To: Alex Shi; +Cc: mingo, tglx, linux-kernel, Venkatesh Pallipadi, Suresh Siddha
On Mon, 2012-09-10 at 15:10 +0800, Alex Shi wrote:
> There is no load_balancer to be selected now. It just set state of
> nohz tick stopping.
>
> So rename the function, pass the 'cpu' from parameter and then
> remove the useless calling from tick_nohz_restart_sched_tick().
Please check who wrote the code you're patching and attempt to CC them
as well, in this case Venki and Suresh.
I think the patch is fine, although I think we could have picked a
better name, how about nohz_balance_enter_idle() ?
> Signed-off-by: Alex Shi <alex.shi@intel.com>
> ---
> include/linux/sched.h | 4 ++--
> kernel/sched/fair.c | 19 +++++++------------
> kernel/time/tick-sched.c | 3 +--
> 3 files changed, 10 insertions(+), 16 deletions(-)
>
> diff --git a/include/linux/sched.h b/include/linux/sched.h
> index b8c8664..5cba49c 100644
> --- a/include/linux/sched.h
> +++ b/include/linux/sched.h
> @@ -273,11 +273,11 @@ extern void init_idle_bootup_task(struct task_struct *idle);
> extern int runqueue_is_locked(int cpu);
>
> #if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ)
> -extern void select_nohz_load_balancer(int stop_tick);
> +extern void set_nohz_tick_stopped(int cpu);
> extern void set_cpu_sd_state_idle(void);
> extern int get_nohz_timer_target(void);
> #else
> -static inline void select_nohz_load_balancer(int stop_tick) { }
> +static inline void set_nohz_tick_stopped(int cpu) { }
> static inline void set_cpu_sd_state_idle(void) { }
> #endif
>
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index c219bf8..5bbc4bf 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -4674,28 +4674,23 @@ void set_cpu_sd_state_idle(void)
> }
>
> /*
> - * This routine will record that this cpu is going idle with tick stopped.
> + * This routine will record that the cpu is going idle with tick stopped.
> * This info will be used in performing idle load balancing in the future.
> */
> -void select_nohz_load_balancer(int stop_tick)
> +void set_nohz_tick_stopped(int cpu)
> {
> - int cpu = smp_processor_id();
> -
> /*
> * If this cpu is going down, then nothing needs to be done.
> */
> if (!cpu_active(cpu))
> return;
>
> - if (stop_tick) {
> - if (test_bit(NOHZ_TICK_STOPPED, nohz_flags(cpu)))
> - return;
> + if (test_bit(NOHZ_TICK_STOPPED, nohz_flags(cpu)))
> + return;
>
> - cpumask_set_cpu(cpu, nohz.idle_cpus_mask);
> - atomic_inc(&nohz.nr_cpus);
> - set_bit(NOHZ_TICK_STOPPED, nohz_flags(cpu));
> - }
> - return;
> + cpumask_set_cpu(cpu, nohz.idle_cpus_mask);
> + atomic_inc(&nohz.nr_cpus);
> + set_bit(NOHZ_TICK_STOPPED, nohz_flags(cpu));
> }
>
> static int __cpuinit sched_ilb_notifier(struct notifier_block *nfb,
> diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
> index 024540f..eacde97 100644
> --- a/kernel/time/tick-sched.c
> +++ b/kernel/time/tick-sched.c
> @@ -372,7 +372,7 @@ static ktime_t tick_nohz_stop_sched_tick(struct tick_sched *ts,
> * the scheduler tick in nohz_restart_sched_tick.
> */
> if (!ts->tick_stopped) {
> - select_nohz_load_balancer(1);
> + set_nohz_tick_stopped(cpu);
> calc_load_enter_idle();
>
> ts->last_tick = hrtimer_get_expires(&ts->sched_timer);
> @@ -569,7 +569,6 @@ static void tick_nohz_restart(struct tick_sched *ts, ktime_t now)
> static void tick_nohz_restart_sched_tick(struct tick_sched *ts, ktime_t now)
> {
> /* Update jiffies first */
> - select_nohz_load_balancer(0);
> tick_do_update_jiffies64(now);
> update_cpu_load_nohz();
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/2] nohz: clean up select_nohz_load_balancer()
2012-09-10 15:26 ` [PATCH 1/2] nohz: clean up select_nohz_load_balancer() Peter Zijlstra
@ 2012-09-11 1:27 ` Alex Shi
2012-09-11 18:33 ` Suresh Siddha
0 siblings, 1 reply; 10+ messages in thread
From: Alex Shi @ 2012-09-11 1:27 UTC (permalink / raw)
To: Peter Zijlstra
Cc: mingo, tglx, linux-kernel, Venkatesh Pallipadi, Suresh Siddha
On 09/10/2012 11:26 PM, Peter Zijlstra wrote:
> On Mon, 2012-09-10 at 15:10 +0800, Alex Shi wrote:
>> There is no load_balancer to be selected now. It just set state of
>> nohz tick stopping.
>>
>> So rename the function, pass the 'cpu' from parameter and then
>> remove the useless calling from tick_nohz_restart_sched_tick().
>
> Please check who wrote the code you're patching and attempt to CC them
> as well, in this case Venki and Suresh.
Thanks! will care about this from now on.
>
> I think the patch is fine, although I think we could have picked a
> better name, how about nohz_balance_enter_idle() ?
nohz_balance_enter_idle is good a name too. but I name it as
set_nohz_tick_stopped, since there is a clear_nohz_tick_stopped(), that
just do the opposed action of this function. According to this, is it
better to another function to nohz_balance_leave_idle()?
Or keep their current name?
Thanks
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/2] nohz: clean up select_nohz_load_balancer()
2012-09-11 1:27 ` Alex Shi
@ 2012-09-11 18:33 ` Suresh Siddha
2012-09-13 8:25 ` Peter Zijlstra
0 siblings, 1 reply; 10+ messages in thread
From: Suresh Siddha @ 2012-09-11 18:33 UTC (permalink / raw)
To: Alex Shi; +Cc: Peter Zijlstra, mingo, tglx, linux-kernel, Venkatesh Pallipadi
On Tue, 2012-09-11 at 09:27 +0800, Alex Shi wrote:
> On 09/10/2012 11:26 PM, Peter Zijlstra wrote:
>
> > On Mon, 2012-09-10 at 15:10 +0800, Alex Shi wrote:
> >> There is no load_balancer to be selected now. It just set state of
> >> nohz tick stopping.
> >>
> >> So rename the function, pass the 'cpu' from parameter and then
> >> remove the useless calling from tick_nohz_restart_sched_tick().
> >
> > Please check who wrote the code you're patching and attempt to CC them
> > as well, in this case Venki and Suresh.
>
>
> Thanks! will care about this from now on.
>
> >
> > I think the patch is fine, although I think we could have picked a
> > better name, how about nohz_balance_enter_idle() ?
>
>
> nohz_balance_enter_idle is good a name too. but I name it as
> set_nohz_tick_stopped, since there is a clear_nohz_tick_stopped(), that
> just do the opposed action of this function. According to this, is it
> better to another function to nohz_balance_leave_idle()?
> Or keep their current name?
>
Yes that will be more appropriate name.
Acked-by: Suresh Siddha <suresh.b.siddha@intel.com>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 2/2] sched: trigger_load_balance clean up
2012-09-10 7:10 ` [PATCH 2/2] sched: trigger_load_balance clean up Alex Shi
@ 2012-09-11 18:36 ` Suresh Siddha
2012-09-12 7:58 ` Alex Shi
0 siblings, 1 reply; 10+ messages in thread
From: Suresh Siddha @ 2012-09-11 18:36 UTC (permalink / raw)
To: Alex Shi; +Cc: mingo, peterz, tglx, linux-kernel, venki
On Mon, 2012-09-10 at 15:10 +0800, Alex Shi wrote:
> Remove a redundant check for on_null_domain(cpu), and rerange the code
> that make it more readable.
hmm, but we are now doing the on_null_domain() check always,
irrespective of whether we need the load balance or not.
do we really need the on_null_domain() check there? What happens if we
just remove it?
thanks,
suresh
>
> Signed-off-by: Alex Shi <alex.shi@intel.com>
> ---
> kernel/sched/fair.c | 8 +++++---
> 1 files changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index 5bbc4bf..529092d 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -4934,11 +4934,13 @@ static inline int on_null_domain(int cpu)
> void trigger_load_balance(struct rq *rq, int cpu)
> {
> /* Don't need to rebalance while attached to NULL domain */
> - if (time_after_eq(jiffies, rq->next_balance) &&
> - likely(!on_null_domain(cpu)))
> + if (unlikely(on_null_domain(cpu)))
> + return;
> +
> + if (time_after_eq(jiffies, rq->next_balance))
> raise_softirq(SCHED_SOFTIRQ);
> #ifdef CONFIG_NO_HZ
> - if (nohz_kick_needed(rq, cpu) && likely(!on_null_domain(cpu)))
> + if (nohz_kick_needed(rq, cpu))
> nohz_balancer_kick(cpu);
> #endif
> }
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 2/2] sched: trigger_load_balance clean up
2012-09-11 18:36 ` Suresh Siddha
@ 2012-09-12 7:58 ` Alex Shi
2012-09-12 22:16 ` Suresh Siddha
0 siblings, 1 reply; 10+ messages in thread
From: Alex Shi @ 2012-09-12 7:58 UTC (permalink / raw)
To: Suresh Siddha; +Cc: mingo, peterz, tglx, linux-kernel, venki, Paul E. McKenney
On 09/12/2012 02:36 AM, Suresh Siddha wrote:
> On Mon, 2012-09-10 at 15:10 +0800, Alex Shi wrote:
>> Remove a redundant check for on_null_domain(cpu), and rerange the code
>> that make it more readable.
>
> hmm, but we are now doing the on_null_domain() check always,
> irrespective of whether we need the load balance or not.
>
> do we really need the on_null_domain() check there? What happens if we
> just remove it?
A very very simple try can not show removing causes crash. But as to
RCU details, I don't know. :(
CC to Paul
>
> thanks,
> suresh
>
>>
>> Signed-off-by: Alex Shi <alex.shi@intel.com>
>> ---
>> kernel/sched/fair.c | 8 +++++---
>> 1 files changed, 5 insertions(+), 3 deletions(-)
>>
>> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
>> index 5bbc4bf..529092d 100644
>> --- a/kernel/sched/fair.c
>> +++ b/kernel/sched/fair.c
>> @@ -4934,11 +4934,13 @@ static inline int on_null_domain(int cpu)
>> void trigger_load_balance(struct rq *rq, int cpu)
>> {
>> /* Don't need to rebalance while attached to NULL domain */
>> - if (time_after_eq(jiffies, rq->next_balance) &&
>> - likely(!on_null_domain(cpu)))
>> + if (unlikely(on_null_domain(cpu)))
>> + return;
>> +
>> + if (time_after_eq(jiffies, rq->next_balance))
>> raise_softirq(SCHED_SOFTIRQ);
>> #ifdef CONFIG_NO_HZ
>> - if (nohz_kick_needed(rq, cpu) && likely(!on_null_domain(cpu)))
>> + if (nohz_kick_needed(rq, cpu))
>> nohz_balancer_kick(cpu);
>> #endif
>> }
>
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 2/2] sched: trigger_load_balance clean up
2012-09-12 7:58 ` Alex Shi
@ 2012-09-12 22:16 ` Suresh Siddha
0 siblings, 0 replies; 10+ messages in thread
From: Suresh Siddha @ 2012-09-12 22:16 UTC (permalink / raw)
To: Alex Shi; +Cc: mingo, peterz, tglx, linux-kernel, venki, Paul E. McKenney
On Wed, 2012-09-12 at 15:58 +0800, Alex Shi wrote:
> On 09/12/2012 02:36 AM, Suresh Siddha wrote:
>
> > On Mon, 2012-09-10 at 15:10 +0800, Alex Shi wrote:
> >> Remove a redundant check for on_null_domain(cpu), and rerange the code
> >> that make it more readable.
> >
> > hmm, but we are now doing the on_null_domain() check always,
> > irrespective of whether we need the load balance or not.
> >
> > do we really need the on_null_domain() check there? What happens if we
> > just remove it?
>
>
> A very very simple try can not show removing causes crash. But as to
> RCU details, I don't know. :(
>
So the right way to approach the issue is to do couple of "git blame"
and see who added that code. My check shows
commit 8a0be9ef8225638d26b455788f988c8f84ce9e75
Author: Frederic Weisbecker <fweisbec@gmail.com>
Date: Thu Mar 5 01:27:02 2009 +0100
sched: don't rebalance if attached on NULL domain
And the changelog explains that it has to do with avoiding unnecessary
loadbalances (triggered by softirq) for a SMP kernel on a UP system and
actually has nothing to do with RCU per-say (as the load balancer
already takes the rcu locks etc before traversing the scheduler-domain).
And the second on_null_domain() in that function is added by Venki and
me, probably by mistake. As the nohz_kick_needed() will never return
true for the SMP kernel running on a UP system.
So please just remove the second on_null_domain() check in that function
instead of consolidating both the usages and include the above info in
the changelog.
thanks,
suresh
> >
> > thanks,
> > suresh
> >
> >>
> >> Signed-off-by: Alex Shi <alex.shi@intel.com>
> >> ---
> >> kernel/sched/fair.c | 8 +++++---
> >> 1 files changed, 5 insertions(+), 3 deletions(-)
> >>
> >> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> >> index 5bbc4bf..529092d 100644
> >> --- a/kernel/sched/fair.c
> >> +++ b/kernel/sched/fair.c
> >> @@ -4934,11 +4934,13 @@ static inline int on_null_domain(int cpu)
> >> void trigger_load_balance(struct rq *rq, int cpu)
> >> {
> >> /* Don't need to rebalance while attached to NULL domain */
> >> - if (time_after_eq(jiffies, rq->next_balance) &&
> >> - likely(!on_null_domain(cpu)))
> >> + if (unlikely(on_null_domain(cpu)))
> >> + return;
> >> +
> >> + if (time_after_eq(jiffies, rq->next_balance))
> >> raise_softirq(SCHED_SOFTIRQ);
> >> #ifdef CONFIG_NO_HZ
> >> - if (nohz_kick_needed(rq, cpu) && likely(!on_null_domain(cpu)))
> >> + if (nohz_kick_needed(rq, cpu))
> >> nohz_balancer_kick(cpu);
> >> #endif
> >> }
> >
> >
>
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/2] nohz: clean up select_nohz_load_balancer()
2012-09-11 18:33 ` Suresh Siddha
@ 2012-09-13 8:25 ` Peter Zijlstra
0 siblings, 0 replies; 10+ messages in thread
From: Peter Zijlstra @ 2012-09-13 8:25 UTC (permalink / raw)
To: Suresh Siddha; +Cc: Alex Shi, mingo, tglx, linux-kernel, Venkatesh Pallipadi
On Tue, 2012-09-11 at 11:33 -0700, Suresh Siddha wrote:
> > nohz_balance_enter_idle is good a name too. but I name it as
> > set_nohz_tick_stopped, since there is a clear_nohz_tick_stopped(), that
> > just do the opposed action of this function. According to this, is it
> > better to another function to nohz_balance_leave_idle()?
> > Or keep their current name?
> >
>
> Yes that will be more appropriate name.
I've made it:
nohz_balance_{enter,exit}_idle()
Most of the nohz stuff has the {enter,exit}.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [tip:sched/core] sched/nohz: Clean up select_nohz_load_balancer()
2012-09-10 7:10 [PATCH 1/2] nohz: clean up select_nohz_load_balancer() Alex Shi
2012-09-10 7:10 ` [PATCH 2/2] sched: trigger_load_balance clean up Alex Shi
2012-09-10 15:26 ` [PATCH 1/2] nohz: clean up select_nohz_load_balancer() Peter Zijlstra
@ 2012-09-14 6:15 ` tip-bot for Alex Shi
2 siblings, 0 replies; 10+ messages in thread
From: tip-bot for Alex Shi @ 2012-09-14 6:15 UTC (permalink / raw)
To: linux-tip-commits
Cc: linux-kernel, hpa, mingo, a.p.zijlstra, alex.shi,
suresh.b.siddha, tglx, venki
Commit-ID: c1cc017c59c44d9ede7003631c43adc0cfdce2f9
Gitweb: http://git.kernel.org/tip/c1cc017c59c44d9ede7003631c43adc0cfdce2f9
Author: Alex Shi <alex.shi@intel.com>
AuthorDate: Mon, 10 Sep 2012 15:10:58 +0800
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Thu, 13 Sep 2012 16:52:05 +0200
sched/nohz: Clean up select_nohz_load_balancer()
There is no load_balancer to be selected now. It just sets the
state of the nohz tick to stop.
So rename the function, pass the 'cpu' as a parameter and then
remove the useless call from tick_nohz_restart_sched_tick().
[ s/set_nohz_tick_stopped/nohz_balance_enter_idle/g
s/clear_nohz_tick_stopped/nohz_balance_exit_idle/g ]
Signed-off-by: Alex Shi <alex.shi@intel.com>
Acked-by: Suresh Siddha <suresh.b.siddha@intel.com>
Cc: Venkatesh Pallipadi <venki@google.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1347261059-24747-1-git-send-email-alex.shi@intel.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
include/linux/sched.h | 4 ++--
kernel/sched/fair.c | 25 ++++++++++---------------
kernel/time/tick-sched.c | 3 +--
3 files changed, 13 insertions(+), 19 deletions(-)
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 60e5e38..8c38df0 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -273,11 +273,11 @@ extern void init_idle_bootup_task(struct task_struct *idle);
extern int runqueue_is_locked(int cpu);
#if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ)
-extern void select_nohz_load_balancer(int stop_tick);
+extern void nohz_balance_enter_idle(int cpu);
extern void set_cpu_sd_state_idle(void);
extern int get_nohz_timer_target(void);
#else
-static inline void select_nohz_load_balancer(int stop_tick) { }
+static inline void nohz_balance_enter_idle(int cpu) { }
static inline void set_cpu_sd_state_idle(void) { }
#endif
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 9ae3a5b..de596a2 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -4603,7 +4603,7 @@ static void nohz_balancer_kick(int cpu)
return;
}
-static inline void clear_nohz_tick_stopped(int cpu)
+static inline void nohz_balance_exit_idle(int cpu)
{
if (unlikely(test_bit(NOHZ_TICK_STOPPED, nohz_flags(cpu)))) {
cpumask_clear_cpu(cpu, nohz.idle_cpus_mask);
@@ -4643,28 +4643,23 @@ void set_cpu_sd_state_idle(void)
}
/*
- * This routine will record that this cpu is going idle with tick stopped.
+ * This routine will record that the cpu is going idle with tick stopped.
* This info will be used in performing idle load balancing in the future.
*/
-void select_nohz_load_balancer(int stop_tick)
+void nohz_balance_enter_idle(int cpu)
{
- int cpu = smp_processor_id();
-
/*
* If this cpu is going down, then nothing needs to be done.
*/
if (!cpu_active(cpu))
return;
- if (stop_tick) {
- if (test_bit(NOHZ_TICK_STOPPED, nohz_flags(cpu)))
- return;
+ if (test_bit(NOHZ_TICK_STOPPED, nohz_flags(cpu)))
+ return;
- cpumask_set_cpu(cpu, nohz.idle_cpus_mask);
- atomic_inc(&nohz.nr_cpus);
- set_bit(NOHZ_TICK_STOPPED, nohz_flags(cpu));
- }
- return;
+ cpumask_set_cpu(cpu, nohz.idle_cpus_mask);
+ atomic_inc(&nohz.nr_cpus);
+ set_bit(NOHZ_TICK_STOPPED, nohz_flags(cpu));
}
static int __cpuinit sched_ilb_notifier(struct notifier_block *nfb,
@@ -4672,7 +4667,7 @@ static int __cpuinit sched_ilb_notifier(struct notifier_block *nfb,
{
switch (action & ~CPU_TASKS_FROZEN) {
case CPU_DYING:
- clear_nohz_tick_stopped(smp_processor_id());
+ nohz_balance_exit_idle(smp_processor_id());
return NOTIFY_OK;
default:
return NOTIFY_DONE;
@@ -4833,7 +4828,7 @@ static inline int nohz_kick_needed(struct rq *rq, int cpu)
* busy tick after returning from idle, we will update the busy stats.
*/
set_cpu_sd_state_busy();
- clear_nohz_tick_stopped(cpu);
+ nohz_balance_exit_idle(cpu);
/*
* None are in tickless mode and hence no need for NOHZ idle load
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
index 3a9e5d5..1a5ee90 100644
--- a/kernel/time/tick-sched.c
+++ b/kernel/time/tick-sched.c
@@ -372,7 +372,7 @@ static ktime_t tick_nohz_stop_sched_tick(struct tick_sched *ts,
* the scheduler tick in nohz_restart_sched_tick.
*/
if (!ts->tick_stopped) {
- select_nohz_load_balancer(1);
+ nohz_balance_enter_idle(cpu);
calc_load_enter_idle();
ts->last_tick = hrtimer_get_expires(&ts->sched_timer);
@@ -569,7 +569,6 @@ static void tick_nohz_restart(struct tick_sched *ts, ktime_t now)
static void tick_nohz_restart_sched_tick(struct tick_sched *ts, ktime_t now)
{
/* Update jiffies first */
- select_nohz_load_balancer(0);
tick_do_update_jiffies64(now);
update_cpu_load_nohz();
^ permalink raw reply related [flat|nested] 10+ messages in thread
end of thread, other threads:[~2012-09-14 6:15 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-10 7:10 [PATCH 1/2] nohz: clean up select_nohz_load_balancer() Alex Shi
2012-09-10 7:10 ` [PATCH 2/2] sched: trigger_load_balance clean up Alex Shi
2012-09-11 18:36 ` Suresh Siddha
2012-09-12 7:58 ` Alex Shi
2012-09-12 22:16 ` Suresh Siddha
2012-09-10 15:26 ` [PATCH 1/2] nohz: clean up select_nohz_load_balancer() Peter Zijlstra
2012-09-11 1:27 ` Alex Shi
2012-09-11 18:33 ` Suresh Siddha
2012-09-13 8:25 ` Peter Zijlstra
2012-09-14 6:15 ` [tip:sched/core] sched/nohz: Clean " tip-bot for Alex Shi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).