Skip to content

Commit

Permalink
rcu: Define RCU-sched API in terms of RCU for Tree RCU PREEMPT builds
Browse files Browse the repository at this point in the history
Now that RCU-preempt knows about preemption disabling, its implementation
of synchronize_rcu() works for synchronize_sched(), and likewise for the
other RCU-sched update-side API members.  This commit therefore confines
the RCU-sched update-side code to CONFIG_PREEMPT=n builds, and defines
RCU-sched's update-side API members in terms of those of RCU-preempt.

This means that any given build of the Linux kernel has only one
update-side flavor of RCU, namely RCU-preempt for CONFIG_PREEMPT=y builds
and RCU-sched for CONFIG_PREEMPT=n builds.  This in turn means that kernels
built with CONFIG_RCU_NOCB_CPU=y have only one rcuo kthread per CPU.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Andi Kleen <ak@linux.intel.com>
  • Loading branch information
Paul E. McKenney committed Aug 30, 2018
1 parent 4cf439a commit 45975c7
Show file tree
Hide file tree
Showing 7 changed files with 308 additions and 480 deletions.
14 changes: 4 additions & 10 deletions include/linux/rcupdate.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@

/* Exported common interfaces */

#ifdef CONFIG_PREEMPT_RCU
void call_rcu(struct rcu_head *head, rcu_callback_t func);
#else /* #ifdef CONFIG_PREEMPT_RCU */
#ifdef CONFIG_TINY_RCU
#define call_rcu call_rcu_sched
#endif /* #else #ifdef CONFIG_PREEMPT_RCU */
#else
void call_rcu(struct rcu_head *head, rcu_callback_t func);
#endif

void call_rcu_sched(struct rcu_head *head, rcu_callback_t func);
void synchronize_sched(void);
Expand Down Expand Up @@ -92,11 +92,6 @@ static inline void __rcu_read_unlock(void)
preempt_enable();
}

static inline void synchronize_rcu(void)
{
synchronize_sched();
}

static inline int rcu_preempt_depth(void)
{
return 0;
Expand All @@ -107,7 +102,6 @@ static inline int rcu_preempt_depth(void)
/* Internal to kernel */
void rcu_init(void);
extern int rcu_scheduler_active __read_mostly;
void rcu_sched_qs(void);
void rcu_check_callbacks(int user);
void rcu_report_dead(unsigned int cpu);
void rcutree_migrate_callbacks(int cpu);
Expand Down
7 changes: 7 additions & 0 deletions include/linux/rcutiny.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ static inline int rcu_dynticks_snap(struct rcu_dynticks *rdtp)
/* Never flag non-existent other CPUs! */
static inline bool rcu_eqs_special_set(int cpu) { return false; }

static inline void synchronize_rcu(void)
{
synchronize_sched();
}

static inline unsigned long get_state_synchronize_rcu(void)
{
return 0;
Expand Down Expand Up @@ -94,6 +99,8 @@ static inline void kfree_call_rcu(struct rcu_head *head,
call_rcu(head, func);
}

void rcu_sched_qs(void);

static inline void rcu_softirq_qs(void)
{
rcu_sched_qs();
Expand Down
7 changes: 6 additions & 1 deletion include/linux/rcutree.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,19 @@ static inline void rcu_virt_note_context_switch(int cpu)
rcu_note_context_switch(false);
}

void synchronize_rcu(void);
static inline void synchronize_rcu_bh(void)
{
synchronize_rcu();
}

void synchronize_sched_expedited(void);
void synchronize_rcu_expedited(void);

static inline void synchronize_sched_expedited(void)
{
synchronize_rcu_expedited();
}

void kfree_call_rcu(struct rcu_head *head, rcu_callback_t func);

/**
Expand Down
Loading

0 comments on commit 45975c7

Please sign in to comment.