summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorZqiang <qiang1.zhang@intel.com>2022-12-15 06:57:55 +0300
committerPaul E. McKenney <paulmck@kernel.org>2023-01-04 04:28:34 +0300
commit3d1adf7ada352b80e037509d26cdca156f75e830 (patch)
tree015b1388da4ad7022a285454156239546f1d25f8 /kernel
parent2d7f00b2f01301d6e41fd4a28030dab0442265be (diff)
downloadlinux-3d1adf7ada352b80e037509d26cdca156f75e830.tar.xz
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 <qiang1.zhang@intel.com> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/rcu/tree.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index 0147e69ea85a..15f976506472 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -3333,9 +3333,10 @@ void __init kfree_rcu_scheduler_running(void)
*/
static int rcu_blocking_is_gp(void)
{
- if (rcu_scheduler_active != RCU_SCHEDULER_INACTIVE)
+ if (rcu_scheduler_active != RCU_SCHEDULER_INACTIVE) {
+ might_sleep();
return false;
- might_sleep(); /* Check for RCU read-side critical section. */
+ }
return true;
}