Skip to content

Commit 709fdce

Browse files
committed
rcu: Express Tiny RCU updates in terms of RCU rather than RCU-sched
This commit renames Tiny RCU functions so that the lowest level of functionality is RCU (e.g., synchronize_rcu()) rather than RCU-sched (e.g., synchronize_sched()). This provides greater naming compatibility with Tree RCU, which will in turn permit more LoC removal once the RCU-sched and RCU-bh update-side API is removed. Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> [ paulmck: Fix Tiny call_rcu()'s EXPORT_SYMBOL() in response to a bug report from kbuild test robot. ]
1 parent 45975c7 commit 709fdce

4 files changed

Lines changed: 48 additions & 47 deletions

File tree

‎include/linux/rcupdate.h‎

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,14 @@
4949

5050
/* Exported common interfaces */
5151

52-
#ifdef CONFIG_TINY_RCU
53-
#define call_rcu call_rcu_sched
54-
#else
55-
void call_rcu(struct rcu_head *head, rcu_callback_t func);
52+
#ifndef CONFIG_TINY_RCU
53+
void synchronize_sched(void);
54+
void call_rcu_sched(struct rcu_head *head, rcu_callback_t func);
5655
#endif
5756

58-
void call_rcu_sched(struct rcu_head *head, rcu_callback_t func);
59-
void synchronize_sched(void);
57+
void call_rcu(struct rcu_head *head, rcu_callback_t func);
6058
void rcu_barrier_tasks(void);
59+
void synchronize_rcu(void);
6160

6261
static inline void call_rcu_bh(struct rcu_head *head, rcu_callback_t func)
6362
{
@@ -68,7 +67,6 @@ static inline void call_rcu_bh(struct rcu_head *head, rcu_callback_t func)
6867

6968
void __rcu_read_lock(void);
7069
void __rcu_read_unlock(void);
71-
void synchronize_rcu(void);
7270

7371
/*
7472
* Defined as a macro as it is a very low level header included from

‎include/linux/rcutiny.h‎

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ static inline int rcu_dynticks_snap(struct rcu_dynticks *rdtp)
3636
/* Never flag non-existent other CPUs! */
3737
static inline bool rcu_eqs_special_set(int cpu) { return false; }
3838

39-
static inline void synchronize_rcu(void)
39+
static inline void synchronize_sched(void)
4040
{
41-
synchronize_sched();
41+
synchronize_rcu();
4242
}
4343

4444
static inline unsigned long get_state_synchronize_rcu(void)
@@ -61,16 +61,11 @@ static inline void cond_synchronize_sched(unsigned long oldstate)
6161
might_sleep();
6262
}
6363

64-
static inline void synchronize_rcu_expedited(void)
65-
{
66-
synchronize_sched(); /* Only one CPU, so pretty fast anyway!!! */
67-
}
64+
extern void rcu_barrier(void);
6865

69-
extern void rcu_barrier_sched(void);
70-
71-
static inline void rcu_barrier(void)
66+
static inline void rcu_barrier_sched(void)
7267
{
73-
rcu_barrier_sched(); /* Only one CPU, so only one list of callbacks! */
68+
rcu_barrier(); /* Only one CPU, so only one list of callbacks! */
7469
}
7570

7671
static inline void rcu_barrier_bh(void)
@@ -88,27 +83,36 @@ static inline void synchronize_rcu_bh_expedited(void)
8883
synchronize_sched();
8984
}
9085

86+
static inline void synchronize_rcu_expedited(void)
87+
{
88+
synchronize_sched();
89+
}
90+
9191
static inline void synchronize_sched_expedited(void)
9292
{
9393
synchronize_sched();
9494
}
9595

96-
static inline void kfree_call_rcu(struct rcu_head *head,
97-
rcu_callback_t func)
96+
static inline void call_rcu_sched(struct rcu_head *head, rcu_callback_t func)
97+
{
98+
call_rcu(head, func);
99+
}
100+
101+
static inline void kfree_call_rcu(struct rcu_head *head, rcu_callback_t func)
98102
{
99103
call_rcu(head, func);
100104
}
101105

102-
void rcu_sched_qs(void);
106+
void rcu_qs(void);
103107

104108
static inline void rcu_softirq_qs(void)
105109
{
106-
rcu_sched_qs();
110+
rcu_qs();
107111
}
108112

109113
#define rcu_note_context_switch(preempt) \
110114
do { \
111-
rcu_sched_qs(); \
115+
rcu_qs(); \
112116
rcu_tasks_qs(current); \
113117
} while (0)
114118

‎include/linux/rcutree.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ static inline void rcu_virt_note_context_switch(int cpu)
4545
rcu_note_context_switch(false);
4646
}
4747

48-
void synchronize_rcu(void);
4948
static inline void synchronize_rcu_bh(void)
5049
{
5150
synchronize_rcu();

‎kernel/rcu/tiny.c‎

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -46,25 +46,25 @@ struct rcu_ctrlblk {
4646
};
4747

4848
/* Definition for rcupdate control block. */
49-
static struct rcu_ctrlblk rcu_sched_ctrlblk = {
50-
.donetail = &rcu_sched_ctrlblk.rcucblist,
51-
.curtail = &rcu_sched_ctrlblk.rcucblist,
49+
static struct rcu_ctrlblk rcu_ctrlblk = {
50+
.donetail = &rcu_ctrlblk.rcucblist,
51+
.curtail = &rcu_ctrlblk.rcucblist,
5252
};
5353

54-
void rcu_barrier_sched(void)
54+
void rcu_barrier(void)
5555
{
56-
wait_rcu_gp(call_rcu_sched);
56+
wait_rcu_gp(call_rcu);
5757
}
58-
EXPORT_SYMBOL(rcu_barrier_sched);
58+
EXPORT_SYMBOL(rcu_barrier);
5959

6060
/* Record an rcu quiescent state. */
61-
void rcu_sched_qs(void)
61+
void rcu_qs(void)
6262
{
6363
unsigned long flags;
6464

6565
local_irq_save(flags);
66-
if (rcu_sched_ctrlblk.donetail != rcu_sched_ctrlblk.curtail) {
67-
rcu_sched_ctrlblk.donetail = rcu_sched_ctrlblk.curtail;
66+
if (rcu_ctrlblk.donetail != rcu_ctrlblk.curtail) {
67+
rcu_ctrlblk.donetail = rcu_ctrlblk.curtail;
6868
raise_softirq(RCU_SOFTIRQ);
6969
}
7070
local_irq_restore(flags);
@@ -79,7 +79,7 @@ void rcu_sched_qs(void)
7979
void rcu_check_callbacks(int user)
8080
{
8181
if (user)
82-
rcu_sched_qs();
82+
rcu_qs();
8383
}
8484

8585
/* Invoke the RCU callbacks whose grace period has elapsed. */
@@ -90,17 +90,17 @@ static __latent_entropy void rcu_process_callbacks(struct softirq_action *unused
9090

9191
/* Move the ready-to-invoke callbacks to a local list. */
9292
local_irq_save(flags);
93-
if (rcu_sched_ctrlblk.donetail == &rcu_sched_ctrlblk.rcucblist) {
93+
if (rcu_ctrlblk.donetail == &rcu_ctrlblk.rcucblist) {
9494
/* No callbacks ready, so just leave. */
9595
local_irq_restore(flags);
9696
return;
9797
}
98-
list = rcu_sched_ctrlblk.rcucblist;
99-
rcu_sched_ctrlblk.rcucblist = *rcu_sched_ctrlblk.donetail;
100-
*rcu_sched_ctrlblk.donetail = NULL;
101-
if (rcu_sched_ctrlblk.curtail == rcu_sched_ctrlblk.donetail)
102-
rcu_sched_ctrlblk.curtail = &rcu_sched_ctrlblk.rcucblist;
103-
rcu_sched_ctrlblk.donetail = &rcu_sched_ctrlblk.rcucblist;
98+
list = rcu_ctrlblk.rcucblist;
99+
rcu_ctrlblk.rcucblist = *rcu_ctrlblk.donetail;
100+
*rcu_ctrlblk.donetail = NULL;
101+
if (rcu_ctrlblk.curtail == rcu_ctrlblk.donetail)
102+
rcu_ctrlblk.curtail = &rcu_ctrlblk.rcucblist;
103+
rcu_ctrlblk.donetail = &rcu_ctrlblk.rcucblist;
104104
local_irq_restore(flags);
105105

106106
/* Invoke the callbacks on the local list. */
@@ -125,21 +125,21 @@ static __latent_entropy void rcu_process_callbacks(struct softirq_action *unused
125125
*
126126
* Cool, huh? (Due to Josh Triplett.)
127127
*/
128-
void synchronize_sched(void)
128+
void synchronize_rcu(void)
129129
{
130130
RCU_LOCKDEP_WARN(lock_is_held(&rcu_bh_lock_map) ||
131131
lock_is_held(&rcu_lock_map) ||
132132
lock_is_held(&rcu_sched_lock_map),
133133
"Illegal synchronize_sched() in RCU read-side critical section");
134134
}
135-
EXPORT_SYMBOL_GPL(synchronize_sched);
135+
EXPORT_SYMBOL_GPL(synchronize_rcu);
136136

137137
/*
138138
* Post an RCU callback to be invoked after the end of an RCU-sched grace
139139
* period. But since we have but one CPU, that would be after any
140140
* quiescent state.
141141
*/
142-
void call_rcu_sched(struct rcu_head *head, rcu_callback_t func)
142+
void call_rcu(struct rcu_head *head, rcu_callback_t func)
143143
{
144144
unsigned long flags;
145145

@@ -148,16 +148,16 @@ void call_rcu_sched(struct rcu_head *head, rcu_callback_t func)
148148
head->next = NULL;
149149

150150
local_irq_save(flags);
151-
*rcu_sched_ctrlblk.curtail = head;
152-
rcu_sched_ctrlblk.curtail = &head->next;
151+
*rcu_ctrlblk.curtail = head;
152+
rcu_ctrlblk.curtail = &head->next;
153153
local_irq_restore(flags);
154154

155155
if (unlikely(is_idle_task(current))) {
156-
/* force scheduling for rcu_sched_qs() */
156+
/* force scheduling for rcu_qs() */
157157
resched_cpu(0);
158158
}
159159
}
160-
EXPORT_SYMBOL_GPL(call_rcu_sched);
160+
EXPORT_SYMBOL_GPL(call_rcu);
161161

162162
void __init rcu_init(void)
163163
{

0 commit comments

Comments
 (0)