rcu: combine duplicate code, courtesy of CONFIG_PREEMPT_RCU

The CONFIG_PREEMPT_RCU kernel configuration parameter was recently
re-introduced, but as an indication of the type of RCU (preemptible
vs. non-preemptible) instead of as selecting a given implementation.
This commit uses CONFIG_PREEMPT_RCU to combine duplicate code
from include/linux/rcutiny.h and include/linux/rcutree.h into
include/linux/rcupdate.h.  This commit also combines a few other pieces
of duplicate code that have accumulated.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
This commit is contained in:
Paul E. McKenney 2010-08-17 14:18:46 -07:00
parent 73d4da4d36
commit 7b0b759b65
4 changed files with 72 additions and 113 deletions

View file

@ -27,34 +27,10 @@
#include <linux/cache.h>
void rcu_sched_qs(int cpu);
void rcu_bh_qs(int cpu);
#ifdef CONFIG_TINY_RCU
#define __rcu_read_lock() preempt_disable()
#define __rcu_read_unlock() preempt_enable()
#else /* #ifdef CONFIG_TINY_RCU */
void __rcu_read_lock(void);
void __rcu_read_unlock(void);
#endif /* #else #ifdef CONFIG_TINY_RCU */
#define __rcu_read_lock_bh() local_bh_disable()
#define __rcu_read_unlock_bh() local_bh_enable()
extern void call_rcu_sched(struct rcu_head *head,
void (*func)(struct rcu_head *rcu));
#define rcu_init_sched() do { } while (0)
extern void synchronize_sched(void);
#ifdef CONFIG_TINY_RCU
#define call_rcu call_rcu_sched
static inline void synchronize_rcu(void)
{
synchronize_sched();
}
static inline void synchronize_rcu_expedited(void)
{
synchronize_sched(); /* Only one CPU, so pretty fast anyway!!! */
@ -67,7 +43,6 @@ static inline void rcu_barrier(void)
#else /* #ifdef CONFIG_TINY_RCU */
void synchronize_rcu(void);
void rcu_barrier(void);
void synchronize_rcu_expedited(void);
@ -83,25 +58,6 @@ static inline void synchronize_rcu_bh_expedited(void)
synchronize_sched();
}
struct notifier_block;
#ifdef CONFIG_NO_HZ
extern void rcu_enter_nohz(void);
extern void rcu_exit_nohz(void);
#else /* #ifdef CONFIG_NO_HZ */
static inline void rcu_enter_nohz(void)
{
}
static inline void rcu_exit_nohz(void)
{
}
#endif /* #else #ifdef CONFIG_NO_HZ */
#ifdef CONFIG_TINY_RCU
static inline void rcu_preempt_note_context_switch(void)
@ -117,11 +73,6 @@ static inline int rcu_needs_cpu(int cpu)
return 0;
}
static inline int rcu_preempt_depth(void)
{
return 0;
}
#else /* #ifdef CONFIG_TINY_RCU */
void rcu_preempt_note_context_switch(void);
@ -141,8 +92,6 @@ static inline void rcu_note_context_switch(int cpu)
rcu_preempt_note_context_switch();
}
extern void rcu_check_callbacks(int cpu, int user);
/*
* Return the number of grace periods.
*/