public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: josh@joshtriplett.org
To: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Cc: linux-kernel@vger.kernel.org, mingo@kernel.org,
	laijs@cn.fujitsu.com, dipankar@in.ibm.com,
	akpm@linux-foundation.org, mathieu.desnoyers@efficios.com,
	tglx@linutronix.de, peterz@infradead.org, rostedt@goodmis.org,
	dhowells@redhat.com, edumazet@google.com, dvhart@linux.intel.com,
	fweisbec@gmail.com, oleg@redhat.com, bobby.prani@gmail.com
Subject: Re: [PATCH tip/core/rcu 1/3] rcu: Further shrink Tiny RCU by making empty functions static inlines
Date: Tue, 12 May 2015 17:57:18 -0700	[thread overview]
Message-ID: <20150513005717.GC14292@cloud> (raw)
In-Reply-To: <1431470953-4910-1-git-send-email-paulmck@linux.vnet.ibm.com>

On Tue, May 12, 2015 at 03:49:11PM -0700, Paul E. McKenney wrote:
> From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
> 
> The Tiny RCU counterparts to rcu_idle_enter(), rcu_idle_exit(),
> rcu_irq_enter(), and rcu_irq_exit() are empty functions, but each
> has EXPORT_SYMBOL_GPL(), which, in kernels built with module support,
> needlessly consumes some memory.  This commit therefore moves these
> functions to static inlines in rcutiny.h, removing the need for
> exports.
> 
> This won't affect the size of the tiniest kernels, which are likely
> built without module support, but might help semi-tiny kernels that
> might include module support.
> 
> Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>

Even on kernels that don't include module support, this would shave a
few bytes.  Callers can't know a function in another .c file is actually
empty (without LTO, anyway), so callers have to actually *call* these
empty functions, and the functions themselves would need to be emitted.
Turning them into static inlines tells the callers that they can avoid
emitting any code.

Reviewed-by: Josh Triplett <josh@joshtriplett.org>

>  include/linux/rcupdate.h |  4 ----
>  include/linux/rcutiny.h  | 16 ++++++++++++++++
>  include/linux/rcutree.h  |  5 +++++
>  kernel/rcu/tiny.c        | 33 ---------------------------------
>  4 files changed, 21 insertions(+), 37 deletions(-)
> 
> diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
> index 87bb0eee665b..1b3d7bcb3a6c 100644
> --- a/include/linux/rcupdate.h
> +++ b/include/linux/rcupdate.h
> @@ -292,10 +292,6 @@ void rcu_sched_qs(void);
>  void rcu_bh_qs(void);
>  void rcu_check_callbacks(int user);
>  struct notifier_block;
> -void rcu_idle_enter(void);
> -void rcu_idle_exit(void);
> -void rcu_irq_enter(void);
> -void rcu_irq_exit(void);
>  int rcu_cpu_notify(struct notifier_block *self,
>  		   unsigned long action, void *hcpu);
>  
> diff --git a/include/linux/rcutiny.h b/include/linux/rcutiny.h
> index 937edaeb150d..3df6c1ec4e25 100644
> --- a/include/linux/rcutiny.h
> +++ b/include/linux/rcutiny.h
> @@ -159,6 +159,22 @@ static inline void rcu_cpu_stall_reset(void)
>  {
>  }
>  
> +static inline void rcu_idle_enter(void)
> +{
> +}
> +
> +static inline void rcu_idle_exit(void)
> +{
> +}
> +
> +static inline void rcu_irq_enter(void)
> +{
> +}
> +
> +static inline void rcu_irq_exit(void)
> +{
> +}
> +
>  static inline void exit_rcu(void)
>  {
>  }
> diff --git a/include/linux/rcutree.h b/include/linux/rcutree.h
> index d2e583a6aaca..f22d83f49e56 100644
> --- a/include/linux/rcutree.h
> +++ b/include/linux/rcutree.h
> @@ -93,6 +93,11 @@ void rcu_force_quiescent_state(void);
>  void rcu_bh_force_quiescent_state(void);
>  void rcu_sched_force_quiescent_state(void);
>  
> +void rcu_idle_enter(void);
> +void rcu_idle_exit(void);
> +void rcu_irq_enter(void);
> +void rcu_irq_exit(void);
> +
>  void exit_rcu(void);
>  
>  void rcu_scheduler_starting(void);
> diff --git a/kernel/rcu/tiny.c b/kernel/rcu/tiny.c
> index 069742d61c68..a501b4ab9b1c 100644
> --- a/kernel/rcu/tiny.c
> +++ b/kernel/rcu/tiny.c
> @@ -49,39 +49,6 @@ static void __call_rcu(struct rcu_head *head,
>  
>  #include "tiny_plugin.h"
>  
> -/*
> - * Enter idle, which is an extended quiescent state if we have fully
> - * entered that mode.
> - */
> -void rcu_idle_enter(void)
> -{
> -}
> -EXPORT_SYMBOL_GPL(rcu_idle_enter);
> -
> -/*
> - * Exit an interrupt handler towards idle.
> - */
> -void rcu_irq_exit(void)
> -{
> -}
> -EXPORT_SYMBOL_GPL(rcu_irq_exit);
> -
> -/*
> - * Exit idle, so that we are no longer in an extended quiescent state.
> - */
> -void rcu_idle_exit(void)
> -{
> -}
> -EXPORT_SYMBOL_GPL(rcu_idle_exit);
> -
> -/*
> - * Enter an interrupt handler, moving away from idle.
> - */
> -void rcu_irq_enter(void)
> -{
> -}
> -EXPORT_SYMBOL_GPL(rcu_irq_enter);
> -
>  #if defined(CONFIG_DEBUG_LOCK_ALLOC) || defined(CONFIG_RCU_TRACE)
>  
>  /*
> -- 
> 1.8.1.5
> 

  parent reply	other threads:[~2015-05-13  0:57 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-12 22:48 [PATCH tip/core/rcu 0/3] Tiny RCU updates for 4.2 Paul E. McKenney
2015-05-12 22:49 ` [PATCH tip/core/rcu 1/3] rcu: Further shrink Tiny RCU by making empty functions static inlines Paul E. McKenney
2015-05-12 22:49   ` [PATCH tip/core/rcu 2/3] rcutorture: Test both RCU-sched and RCU-bh for Tiny RCU Paul E. McKenney
2015-05-13  0:59     ` josh
2015-05-13 13:03       ` Steven Rostedt
2015-05-13 13:07       ` Paul E. McKenney
2015-05-13 16:32         ` Josh Triplett
2015-05-12 22:49   ` [PATCH tip/core/rcu 3/3] rcu: Correctly handle non-empty Tiny RCU callback list with none ready Paul E. McKenney
2015-05-13  0:58     ` josh
2015-05-13 13:09       ` Paul E. McKenney
2015-05-13  0:57   ` josh [this message]
2015-05-13 12:59     ` [PATCH tip/core/rcu 1/3] rcu: Further shrink Tiny RCU by making empty functions static inlines Paul E. McKenney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150513005717.GC14292@cloud \
    --to=josh@joshtriplett.org \
    --cc=akpm@linux-foundation.org \
    --cc=bobby.prani@gmail.com \
    --cc=dhowells@redhat.com \
    --cc=dipankar@in.ibm.com \
    --cc=dvhart@linux.intel.com \
    --cc=edumazet@google.com \
    --cc=fweisbec@gmail.com \
    --cc=laijs@cn.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mingo@kernel.org \
    --cc=oleg@redhat.com \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox