mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-26 14:17:26 -04:00
rcu: Simplify unboosting checks
Commit 7765be (Fix RCU_BOOST race handling current->rcu_read_unlock_special) introduced a new ->rcu_boosted field in the task structure. This is redundant because the existing ->rcu_boost_mutex will be non-NULL at any time that ->rcu_boosted is nonzero. Therefore, this commit removes ->rcu_boosted and tests ->rcu_boost_mutex instead. Signed-off-by: Paul E. McKenney <paul.mckenney@linaro.org> Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
This commit is contained in:
parent
5c51dd7349
commit
82e78d80fc
2 changed files with 10 additions and 13 deletions
|
@ -1259,9 +1259,6 @@ struct task_struct {
|
||||||
#ifdef CONFIG_PREEMPT_RCU
|
#ifdef CONFIG_PREEMPT_RCU
|
||||||
int rcu_read_lock_nesting;
|
int rcu_read_lock_nesting;
|
||||||
char rcu_read_unlock_special;
|
char rcu_read_unlock_special;
|
||||||
#if defined(CONFIG_RCU_BOOST) && defined(CONFIG_TREE_PREEMPT_RCU)
|
|
||||||
int rcu_boosted;
|
|
||||||
#endif /* #if defined(CONFIG_RCU_BOOST) && defined(CONFIG_TREE_PREEMPT_RCU) */
|
|
||||||
struct list_head rcu_node_entry;
|
struct list_head rcu_node_entry;
|
||||||
#endif /* #ifdef CONFIG_PREEMPT_RCU */
|
#endif /* #ifdef CONFIG_PREEMPT_RCU */
|
||||||
#ifdef CONFIG_TREE_PREEMPT_RCU
|
#ifdef CONFIG_TREE_PREEMPT_RCU
|
||||||
|
|
|
@ -306,6 +306,9 @@ static noinline void rcu_read_unlock_special(struct task_struct *t)
|
||||||
int empty_exp;
|
int empty_exp;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
struct list_head *np;
|
struct list_head *np;
|
||||||
|
#ifdef CONFIG_RCU_BOOST
|
||||||
|
struct rt_mutex *rbmp = NULL;
|
||||||
|
#endif /* #ifdef CONFIG_RCU_BOOST */
|
||||||
struct rcu_node *rnp;
|
struct rcu_node *rnp;
|
||||||
int special;
|
int special;
|
||||||
|
|
||||||
|
@ -351,6 +354,7 @@ static noinline void rcu_read_unlock_special(struct task_struct *t)
|
||||||
smp_mb(); /* ensure expedited fastpath sees end of RCU c-s. */
|
smp_mb(); /* ensure expedited fastpath sees end of RCU c-s. */
|
||||||
np = rcu_next_node_entry(t, rnp);
|
np = rcu_next_node_entry(t, rnp);
|
||||||
list_del_init(&t->rcu_node_entry);
|
list_del_init(&t->rcu_node_entry);
|
||||||
|
t->rcu_blocked_node = NULL;
|
||||||
trace_rcu_unlock_preempted_task("rcu_preempt",
|
trace_rcu_unlock_preempted_task("rcu_preempt",
|
||||||
rnp->gpnum, t->pid);
|
rnp->gpnum, t->pid);
|
||||||
if (&t->rcu_node_entry == rnp->gp_tasks)
|
if (&t->rcu_node_entry == rnp->gp_tasks)
|
||||||
|
@ -360,13 +364,12 @@ static noinline void rcu_read_unlock_special(struct task_struct *t)
|
||||||
#ifdef CONFIG_RCU_BOOST
|
#ifdef CONFIG_RCU_BOOST
|
||||||
if (&t->rcu_node_entry == rnp->boost_tasks)
|
if (&t->rcu_node_entry == rnp->boost_tasks)
|
||||||
rnp->boost_tasks = np;
|
rnp->boost_tasks = np;
|
||||||
/* Snapshot and clear ->rcu_boosted with rcu_node lock held. */
|
/* Snapshot/clear ->rcu_boost_mutex with rcu_node lock held. */
|
||||||
if (t->rcu_boosted) {
|
if (t->rcu_boost_mutex) {
|
||||||
special |= RCU_READ_UNLOCK_BOOSTED;
|
rbmp = t->rcu_boost_mutex;
|
||||||
t->rcu_boosted = 0;
|
t->rcu_boost_mutex = NULL;
|
||||||
}
|
}
|
||||||
#endif /* #ifdef CONFIG_RCU_BOOST */
|
#endif /* #ifdef CONFIG_RCU_BOOST */
|
||||||
t->rcu_blocked_node = NULL;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If this was the last task on the current list, and if
|
* If this was the last task on the current list, and if
|
||||||
|
@ -387,10 +390,8 @@ static noinline void rcu_read_unlock_special(struct task_struct *t)
|
||||||
|
|
||||||
#ifdef CONFIG_RCU_BOOST
|
#ifdef CONFIG_RCU_BOOST
|
||||||
/* Unboost if we were boosted. */
|
/* Unboost if we were boosted. */
|
||||||
if (special & RCU_READ_UNLOCK_BOOSTED) {
|
if (rbmp)
|
||||||
rt_mutex_unlock(t->rcu_boost_mutex);
|
rt_mutex_unlock(rbmp);
|
||||||
t->rcu_boost_mutex = NULL;
|
|
||||||
}
|
|
||||||
#endif /* #ifdef CONFIG_RCU_BOOST */
|
#endif /* #ifdef CONFIG_RCU_BOOST */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1206,7 +1207,6 @@ static int rcu_boost(struct rcu_node *rnp)
|
||||||
t = container_of(tb, struct task_struct, rcu_node_entry);
|
t = container_of(tb, struct task_struct, rcu_node_entry);
|
||||||
rt_mutex_init_proxy_locked(&mtx, t);
|
rt_mutex_init_proxy_locked(&mtx, t);
|
||||||
t->rcu_boost_mutex = &mtx;
|
t->rcu_boost_mutex = &mtx;
|
||||||
t->rcu_boosted = 1;
|
|
||||||
raw_spin_unlock_irqrestore(&rnp->lock, flags);
|
raw_spin_unlock_irqrestore(&rnp->lock, flags);
|
||||||
rt_mutex_lock(&mtx); /* Side effect: boosts task t's priority. */
|
rt_mutex_lock(&mtx); /* Side effect: boosts task t's priority. */
|
||||||
rt_mutex_unlock(&mtx); /* Keep lockdep happy. */
|
rt_mutex_unlock(&mtx); /* Keep lockdep happy. */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue