Skip to content

Commit 03bd298

Browse files
committed
rcu: Use lockdep rather than comment to enforce lock held
The rcu_preempt_check_blocked_tasks() function has a comment that states that the rcu_node structure's ->lock must be held, which might be informative, but which carries little weight if not read. This commit therefore removes this comment in favor of raw_lockdep_assert_held_rcu_node(), which will complain quite visibly if the required lock is not held. Signed-off-by: Paul E. McKenney <[email protected]>
1 parent 6935c39 commit 03bd298

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

kernel/rcu/tree_plugin.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -648,8 +648,7 @@ static void rcu_read_unlock_special(struct task_struct *t)
648648
* Check that the list of blocked tasks for the newly completed grace
649649
* period is in fact empty. It is a serious bug to complete a grace
650650
* period that still has RCU readers blocked! This function must be
651-
* invoked -before- updating this rnp's ->gp_seq, and the rnp's ->lock
652-
* must be held by the caller.
651+
* invoked -before- updating this rnp's ->gp_seq.
653652
*
654653
* Also, if there are blocked tasks on the list, they automatically
655654
* block the newly created grace period, so set up ->gp_tasks accordingly.
@@ -659,6 +658,7 @@ static void rcu_preempt_check_blocked_tasks(struct rcu_node *rnp)
659658
struct task_struct *t;
660659

661660
RCU_LOCKDEP_WARN(preemptible(), "rcu_preempt_check_blocked_tasks() invoked with preemption enabled!!!\n");
661+
raw_lockdep_assert_held_rcu_node(rnp);
662662
if (WARN_ON_ONCE(rcu_preempt_blocked_readers_cgp(rnp)))
663663
dump_blkd_tasks(rnp, 10);
664664
if (rcu_preempt_has_tasks(rnp) &&

0 commit comments

Comments
 (0)