rcu: Check the validity of the boost_kthread_task pointer
PATCH 1/1 rcu: Check the validity of the boost_kthread_task pointer
The boost kthreads may spawn failed, although the probability of creation failure is very low, in consideration of the robustness of the code, add boost_kthread_task pointer detection.
--- kernel/rcu/tree_plugin.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/rcu/tree_plugin.h +2 -1
@@ -1125,7 +1125,8 @@ static void rcu_initiate_boost(struct rcu_node *rnp, unsigned long flags) __releases(rnp->lock) {raw_lockdep_assert_held_rcu_node (rnp); -if (!rcu_preempt_blocked_readers_cgp (rnp) && rnp->exp_tasks ==NULL ) { +if (!rnp->boost_kthread_task || + (!rcu_preempt_blocked_readers_cgp (rnp) && rnp->exp_tasks ==NULL )) {raw_spin_unlock_irqrestore_rcu_node (rnp, flags);return ; }
Signature · 1 line
2.25.1
Paul E. McKenney
maintainerQuoted 5 lines · Zqiang
The boost kthreads may spawn failed, although the probability of creation failure is very low, in consideration of the robustness of the code, add
boost_kthread_taskpointer detection.Signed-off-by Zqiang <[email protected]>
Good catch! As you say, rare, but definitely worth fixing.
I could not resist a bit of wordsmithing. Could you please check to see if I messed something up?
Thanx, Paul
------------------------------------------------------------------------
commit ad3c438e248cbc41fe30a41287621c3dbfcdf51c
Author: Zqiang <[email protected]> Date: Thu Mar 24 19:15:15 2022 +0800
rcu: Check for successful spawn of ->boost_kthread_task
For the spawning of the priority-boost kthreads can fail, improbable though this might seem. This commit therefore refrains from attemoting to initiate RCU priority boosting when The ->boost_kthread_task pointer is NULL.
kernel/rcu/tree_plugin.h +2 -1
@@ -1125,7 +1125,8 @@ static void rcu_initiate_boost(struct rcu_node *rnp, unsigned long flags) __releases(rnp->lock) {raw_lockdep_assert_held_rcu_node (rnp); -if (!rcu_preempt_blocked_readers_cgp (rnp) && rnp->exp_tasks ==NULL ) { +if (!rnp->boost_kthread_task || + (!rcu_preempt_blocked_readers_cgp (rnp) && !rnp->exp_tasks)) {raw_spin_unlock_irqrestore_rcu_node (rnp, flags);return ; }
Quoted 9 lines · Zqiang
The boost kthreads may spawn failed, although the probability of creation failure is very low, in consideration of the robustness of the code, add
boost_kthread_taskpointer detection.Signed-off-by Zqiang <[email protected]>Good catch! As you say, rare, but definitely worth fixing.
I could not resist a bit of wordsmithing. Could you please check to see if I messed something up?
Thanks wordsmithing, I think it's ok.
Thanks,
Zqiang
Quoted 32 lines
Thanx, Paul
------------------------------------------------------------------------
commit
ad3c438e248cbc41fe30a41287621c3dbfcdf51cAuthor: Zqiang <[email protected]> Date: Thu Mar 24 19:15:15 2022 +0800rcu: Check for successful spawn of ->boost_kthread_task
For the spawning of the priority-boost kthreads can fail, improbable though this might seem. This commit therefore refrains from attemoting to initiate RCU priority boosting when The ->boost_kthread_task pointer is NULL.
Signed-off-by Zqiang <[email protected]>Signed-off-by Paul E. McKenney <[email protected]>kernel/rcu/tree_plugin.h +2
-1@@ -1125,7 +1125,8 @@ static void rcu_initiate_boost(struct rcu_node *rnp, unsigned long flags) __releases(rnp->lock) {raw_lockdep_assert_held_rcu_node (rnp); -if (!rcu_preempt_blocked_readers_cgp (rnp) && rnp->exp_tasks ==NULL ) { +if (!rnp->boost_kthread_task || + (!rcu_preempt_blocked_readers_cgp (rnp) && !rnp->exp_tasks)) {raw_spin_unlock_irqrestore_rcu_node (rnp, flags);return ; }