public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] nohz: minor cleanups
@ 2015-09-10 19:58 Luiz Capitulino
  2015-09-10 19:58 ` [PATCH 1/3] nohz: mark tick_nohz_full_running as __read_mostly Luiz Capitulino
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Luiz Capitulino @ 2015-09-10 19:58 UTC (permalink / raw)
  To: fweisbec; +Cc: linux-kernel, cmetcalf

Hi,

These are a few minor cleanups I did while doing a code reading,
patches should be self explanatory.

Luiz Capitulino (3):
  nohz: mark tick_nohz_full_running as __read_mostly
  nohz: mark tick_nohz_init_all() as __init
  sched: add_nr_running(): drop tick_nohz_full_cpu() check

 kernel/sched/sched.h     | 20 +++++++++-----------
 kernel/time/tick-sched.c |  4 ++--
 2 files changed, 11 insertions(+), 13 deletions(-)

-- 
2.1.0

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/3] nohz: mark tick_nohz_full_running as __read_mostly
  2015-09-10 19:58 [PATCH 0/3] nohz: minor cleanups Luiz Capitulino
@ 2015-09-10 19:58 ` Luiz Capitulino
  2015-09-10 19:58 ` [PATCH 2/3] nohz: mark tick_nohz_init_all() as __init Luiz Capitulino
  2015-09-10 19:58 ` [PATCH 3/3] sched: add_nr_running(): drop tick_nohz_full_cpu() check Luiz Capitulino
  2 siblings, 0 replies; 7+ messages in thread
From: Luiz Capitulino @ 2015-09-10 19:58 UTC (permalink / raw)
  To: fweisbec; +Cc: linux-kernel, cmetcalf

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
---
 kernel/time/tick-sched.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
index 3319e16..8d45638 100644
--- a/kernel/time/tick-sched.c
+++ b/kernel/time/tick-sched.c
@@ -155,7 +155,7 @@ static void tick_sched_handle(struct tick_sched *ts, struct pt_regs *regs)
 #ifdef CONFIG_NO_HZ_FULL
 cpumask_var_t tick_nohz_full_mask;
 cpumask_var_t housekeeping_mask;
-bool tick_nohz_full_running;
+bool tick_nohz_full_running __read_mostly;
 
 static bool can_stop_full_tick(void)
 {
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/3] nohz: mark tick_nohz_init_all() as __init
  2015-09-10 19:58 [PATCH 0/3] nohz: minor cleanups Luiz Capitulino
  2015-09-10 19:58 ` [PATCH 1/3] nohz: mark tick_nohz_full_running as __read_mostly Luiz Capitulino
@ 2015-09-10 19:58 ` Luiz Capitulino
  2015-09-24 14:33   ` Frederic Weisbecker
  2015-09-10 19:58 ` [PATCH 3/3] sched: add_nr_running(): drop tick_nohz_full_cpu() check Luiz Capitulino
  2 siblings, 1 reply; 7+ messages in thread
From: Luiz Capitulino @ 2015-09-10 19:58 UTC (permalink / raw)
  To: fweisbec; +Cc: linux-kernel, cmetcalf

It's only called by tick_nohz_init().

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
---
 kernel/time/tick-sched.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
index 8d45638..4cc6df03 100644
--- a/kernel/time/tick-sched.c
+++ b/kernel/time/tick-sched.c
@@ -308,7 +308,7 @@ static int tick_nohz_cpu_down_callback(struct notifier_block *nfb,
 	return NOTIFY_OK;
 }
 
-static int tick_nohz_init_all(void)
+static int __init tick_nohz_init_all(void)
 {
 	int err = -1;
 
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/3] sched: add_nr_running(): drop tick_nohz_full_cpu() check
  2015-09-10 19:58 [PATCH 0/3] nohz: minor cleanups Luiz Capitulino
  2015-09-10 19:58 ` [PATCH 1/3] nohz: mark tick_nohz_full_running as __read_mostly Luiz Capitulino
  2015-09-10 19:58 ` [PATCH 2/3] nohz: mark tick_nohz_init_all() as __init Luiz Capitulino
@ 2015-09-10 19:58 ` Luiz Capitulino
  2015-09-24 14:44   ` Frederic Weisbecker
  2 siblings, 1 reply; 7+ messages in thread
From: Luiz Capitulino @ 2015-09-10 19:58 UTC (permalink / raw)
  To: fweisbec; +Cc: linux-kernel, cmetcalf

tick_nohz_full_kick_cpu() performs the same check.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
---
 kernel/sched/sched.h | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index 68cda11..102eb18 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -1323,17 +1323,15 @@ static inline void add_nr_running(struct rq *rq, unsigned count)
 #endif
 
 #ifdef CONFIG_NO_HZ_FULL
-		if (tick_nohz_full_cpu(rq->cpu)) {
-			/*
-			 * Tick is needed if more than one task runs on a CPU.
-			 * Send the target an IPI to kick it out of nohz mode.
-			 *
-			 * We assume that IPI implies full memory barrier and the
-			 * new value of rq->nr_running is visible on reception
-			 * from the target.
-			 */
-			tick_nohz_full_kick_cpu(rq->cpu);
-		}
+		/*
+		 * Tick is needed if more than one task runs on a CPU.
+		 * Send the target an IPI to kick it out of nohz mode.
+		 *
+		 * We assume that IPI implies full memory barrier and the
+		 * new value of rq->nr_running is visible on reception
+		 * from the target.
+		 */
+		tick_nohz_full_kick_cpu(rq->cpu);
 #endif
 	}
 }
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/3] nohz: mark tick_nohz_init_all() as __init
  2015-09-10 19:58 ` [PATCH 2/3] nohz: mark tick_nohz_init_all() as __init Luiz Capitulino
@ 2015-09-24 14:33   ` Frederic Weisbecker
  0 siblings, 0 replies; 7+ messages in thread
From: Frederic Weisbecker @ 2015-09-24 14:33 UTC (permalink / raw)
  To: Luiz Capitulino; +Cc: linux-kernel, cmetcalf

On Thu, Sep 10, 2015 at 03:58:26PM -0400, Luiz Capitulino wrote:
> It's only called by tick_nohz_init().
> 
> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
> ---
>  kernel/time/tick-sched.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
> index 8d45638..4cc6df03 100644
> --- a/kernel/time/tick-sched.c
> +++ b/kernel/time/tick-sched.c
> @@ -308,7 +308,7 @@ static int tick_nohz_cpu_down_callback(struct notifier_block *nfb,
>  	return NOTIFY_OK;
>  }
>  
> -static int tick_nohz_init_all(void)
> +static int __init tick_nohz_init_all(void)
>  {
>  	int err = -1;

For some reasons I thought sections don't apply to static functions. Well I still don't know
but I guess it works as long as the function doesn't get inlined. Or likely it prevents it from
being inlined.

Anyway, I think we can take the patch.

Thanks.


>  
> -- 
> 2.1.0
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 3/3] sched: add_nr_running(): drop tick_nohz_full_cpu() check
  2015-09-10 19:58 ` [PATCH 3/3] sched: add_nr_running(): drop tick_nohz_full_cpu() check Luiz Capitulino
@ 2015-09-24 14:44   ` Frederic Weisbecker
  2015-09-24 14:54     ` Luiz Capitulino
  0 siblings, 1 reply; 7+ messages in thread
From: Frederic Weisbecker @ 2015-09-24 14:44 UTC (permalink / raw)
  To: Luiz Capitulino; +Cc: linux-kernel, cmetcalf

On Thu, Sep 10, 2015 at 03:58:27PM -0400, Luiz Capitulino wrote:
> tick_nohz_full_kick_cpu() performs the same check.
> 
> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
> ---
>  kernel/sched/sched.h | 20 +++++++++-----------
>  1 file changed, 9 insertions(+), 11 deletions(-)
> 
> diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
> index 68cda11..102eb18 100644
> --- a/kernel/sched/sched.h
> +++ b/kernel/sched/sched.h
> @@ -1323,17 +1323,15 @@ static inline void add_nr_running(struct rq *rq, unsigned count)
>  #endif
>  
>  #ifdef CONFIG_NO_HZ_FULL
> -		if (tick_nohz_full_cpu(rq->cpu)) {
> -			/*
> -			 * Tick is needed if more than one task runs on a CPU.
> -			 * Send the target an IPI to kick it out of nohz mode.
> -			 *
> -			 * We assume that IPI implies full memory barrier and the
> -			 * new value of rq->nr_running is visible on reception
> -			 * from the target.
> -			 */
> -			tick_nohz_full_kick_cpu(rq->cpu);
> -		}
> +		/*
> +		 * Tick is needed if more than one task runs on a CPU.
> +		 * Send the target an IPI to kick it out of nohz mode.
> +		 *
> +		 * We assume that IPI implies full memory barrier and the
> +		 * new value of rq->nr_running is visible on reception
> +		 * from the target.
> +		 */
> +		tick_nohz_full_kick_cpu(rq->cpu);

Nope, we want to keep this because tick_nohz_full_cpu() does a static key check.
Most users don't care about nohz_full and I really want to keep nohz full off case
overhead to the bare minimum.

Thanks.

>  #endif
>  	}
>  }
> -- 
> 2.1.0
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 3/3] sched: add_nr_running(): drop tick_nohz_full_cpu() check
  2015-09-24 14:44   ` Frederic Weisbecker
@ 2015-09-24 14:54     ` Luiz Capitulino
  0 siblings, 0 replies; 7+ messages in thread
From: Luiz Capitulino @ 2015-09-24 14:54 UTC (permalink / raw)
  To: Frederic Weisbecker; +Cc: linux-kernel, cmetcalf

On Thu, 24 Sep 2015 16:44:18 +0200
Frederic Weisbecker <fweisbec@gmail.com> wrote:

> On Thu, Sep 10, 2015 at 03:58:27PM -0400, Luiz Capitulino wrote:
> > tick_nohz_full_kick_cpu() performs the same check.
> > 
> > Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
> > ---
> >  kernel/sched/sched.h | 20 +++++++++-----------
> >  1 file changed, 9 insertions(+), 11 deletions(-)
> > 
> > diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
> > index 68cda11..102eb18 100644
> > --- a/kernel/sched/sched.h
> > +++ b/kernel/sched/sched.h
> > @@ -1323,17 +1323,15 @@ static inline void add_nr_running(struct rq *rq, unsigned count)
> >  #endif
> >  
> >  #ifdef CONFIG_NO_HZ_FULL
> > -		if (tick_nohz_full_cpu(rq->cpu)) {
> > -			/*
> > -			 * Tick is needed if more than one task runs on a CPU.
> > -			 * Send the target an IPI to kick it out of nohz mode.
> > -			 *
> > -			 * We assume that IPI implies full memory barrier and the
> > -			 * new value of rq->nr_running is visible on reception
> > -			 * from the target.
> > -			 */
> > -			tick_nohz_full_kick_cpu(rq->cpu);
> > -		}
> > +		/*
> > +		 * Tick is needed if more than one task runs on a CPU.
> > +		 * Send the target an IPI to kick it out of nohz mode.
> > +		 *
> > +		 * We assume that IPI implies full memory barrier and the
> > +		 * new value of rq->nr_running is visible on reception
> > +		 * from the target.
> > +		 */
> > +		tick_nohz_full_kick_cpu(rq->cpu);
> 
> Nope, we want to keep this because tick_nohz_full_cpu() does a static key check.
> Most users don't care about nohz_full and I really want to keep nohz full off case
> overhead to the bare minimum.

Makes sense.

> 
> Thanks.
> 
> >  #endif
> >  	}
> >  }
> > -- 
> > 2.1.0
> > 
> 


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-09-24 14:54 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-10 19:58 [PATCH 0/3] nohz: minor cleanups Luiz Capitulino
2015-09-10 19:58 ` [PATCH 1/3] nohz: mark tick_nohz_full_running as __read_mostly Luiz Capitulino
2015-09-10 19:58 ` [PATCH 2/3] nohz: mark tick_nohz_init_all() as __init Luiz Capitulino
2015-09-24 14:33   ` Frederic Weisbecker
2015-09-10 19:58 ` [PATCH 3/3] sched: add_nr_running(): drop tick_nohz_full_cpu() check Luiz Capitulino
2015-09-24 14:44   ` Frederic Weisbecker
2015-09-24 14:54     ` Luiz Capitulino

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox