Skip to content

Commit 3d1adf7

Browse files
qiangzh3paulmckrcu
authored andcommitted
rcu: Make rcu_blocking_is_gp() stop early-boot might_sleep()
Currently, rcu_blocking_is_gp() invokes might_sleep() even during early boot when interrupts are disabled and before the scheduler is scheduling. This is at best an accident waiting to happen. Therefore, this commit moves that might_sleep() under an rcu_scheduler_active check in order to ensure that might_sleep() is not invoked unless sleeping might actually happen. Signed-off-by: Zqiang <[email protected]> Signed-off-by: Paul E. McKenney <[email protected]>
1 parent 2d7f00b commit 3d1adf7

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

kernel/rcu/tree.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3333,9 +3333,10 @@ void __init kfree_rcu_scheduler_running(void)
33333333
*/
33343334
static int rcu_blocking_is_gp(void)
33353335
{
3336-
if (rcu_scheduler_active != RCU_SCHEDULER_INACTIVE)
3336+
if (rcu_scheduler_active != RCU_SCHEDULER_INACTIVE) {
3337+
might_sleep();
33373338
return false;
3338-
might_sleep(); /* Check for RCU read-side critical section. */
3339+
}
33393340
return true;
33403341
}
33413342

0 commit comments

Comments
 (0)