Skip to content

Commit 615d8d6

Browse files
paulmckrcuchantra
authored andcommitted
rcu-tasks: Provide rcu_trace_implies_rcu_gp()
As an accident of implementation, an RCU Tasks Trace grace period also acts as an RCU grace period. However, this could change at any time. This commit therefore creates an rcu_trace_implies_rcu_gp() that currently returns true to codify this accident. Code relying on this accident must call this function to verify that this accident is still happening. Reported-by: Hou Tao <[email protected]> Signed-off-by: Paul E. McKenney <[email protected]> Cc: Alexei Starovoitov <[email protected]> Cc: Martin KaFai Lau <[email protected]>
1 parent 87e7989 commit 615d8d6

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

include/linux/rcupdate.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,18 @@ static inline void exit_tasks_rcu_start(void) { }
249249
static inline void exit_tasks_rcu_finish(void) { }
250250
#endif /* #else #ifdef CONFIG_TASKS_RCU_GENERIC */
251251

252+
/**
253+
* rcu_trace_implies_rcu_gp - does an RCU Tasks Trace grace period imply an RCU grace period?
254+
*
255+
* As an accident of implementation, an RCU Tasks Trace grace period also
256+
* acts as an RCU grace period. However, this could change at any time.
257+
* Code relying on this accident must call this function to verify that
258+
* this accident is still happening.
259+
*
260+
* You have been warned!
261+
*/
262+
static inline bool rcu_trace_implies_rcu_gp(void) { return true; }
263+
252264
/**
253265
* cond_resched_tasks_rcu_qs - Report potential quiescent states to RCU
254266
*

kernel/rcu/tasks.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1535,6 +1535,8 @@ static void rcu_tasks_trace_postscan(struct list_head *hop)
15351535
{
15361536
// Wait for late-stage exiting tasks to finish exiting.
15371537
// These might have passed the call to exit_tasks_rcu_finish().
1538+
1539+
// If you remove the following line, update rcu_trace_implies_rcu_gp()!!!
15381540
synchronize_rcu();
15391541
// Any tasks that exit after this point will set
15401542
// TRC_NEED_QS_CHECKED in ->trc_reader_special.b.need_qs.

0 commit comments

Comments
 (0)