diff options
author | Paul E. McKenney <paul.mckenney@linaro.org> | 2012-01-11 20:25:17 -0500 |
---|---|---|
committer | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2012-02-21 12:03:43 -0500 |
commit | 1aa03f1188f7b0b85df2de602b33ee7b6fab8e00 (patch) | |
tree | 20ee8fc1aa5bccc8d8cf53c705d9cc766058eaf5 /kernel/rcutiny_plugin.h | |
parent | 8762705ad4ac860bb78434409df463d02ac8f027 (diff) |
rcu: Simplify unboosting checks
This is a port of commit #82e78d80 from TREE_PREEMPT_RCU to
TINY_PREEMPT_RCU.
This commit uses the fact that current->rcu_boost_mutex is set
any time that the RCU_READ_UNLOCK_BOOSTED flag is set in the
current->rcu_read_unlock_special bitmask. This allows tests of
the bit to be changed to tests of the pointer, which in turn allows
the RCU_READ_UNLOCK_BOOSTED flag to be eliminated.
Please note that the check of current->rcu_read_unlock_special need not
change because any time that RCU_READ_UNLOCK_BOOSTED was set, so was
RCU_READ_UNLOCK_BLOCKED. Therefore, __rcu_read_unlock() can continue
testing current->rcu_read_unlock_special for non-zero, as before.
Signed-off-by: Paul E. McKenney <paul.mckenney@linaro.org>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Diffstat (limited to 'kernel/rcutiny_plugin.h')
-rw-r--r-- | kernel/rcutiny_plugin.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/kernel/rcutiny_plugin.h b/kernel/rcutiny_plugin.h index 387c2759e1b0..22ecea0dfb62 100644 --- a/kernel/rcutiny_plugin.h +++ b/kernel/rcutiny_plugin.h | |||
@@ -318,7 +318,6 @@ static int rcu_boost(void) | |||
318 | t = container_of(tb, struct task_struct, rcu_node_entry); | 318 | t = container_of(tb, struct task_struct, rcu_node_entry); |
319 | rt_mutex_init_proxy_locked(&mtx, t); | 319 | rt_mutex_init_proxy_locked(&mtx, t); |
320 | t->rcu_boost_mutex = &mtx; | 320 | t->rcu_boost_mutex = &mtx; |
321 | t->rcu_read_unlock_special |= RCU_READ_UNLOCK_BOOSTED; | ||
322 | raw_local_irq_restore(flags); | 321 | raw_local_irq_restore(flags); |
323 | rt_mutex_lock(&mtx); | 322 | rt_mutex_lock(&mtx); |
324 | rt_mutex_unlock(&mtx); /* Keep lockdep happy. */ | 323 | rt_mutex_unlock(&mtx); /* Keep lockdep happy. */ |
@@ -550,6 +549,9 @@ static noinline void rcu_read_unlock_special(struct task_struct *t) | |||
550 | int empty_exp; | 549 | int empty_exp; |
551 | unsigned long flags; | 550 | unsigned long flags; |
552 | struct list_head *np; | 551 | struct list_head *np; |
552 | #ifdef CONFIG_RCU_BOOST | ||
553 | struct rt_mutex *rbmp = NULL; | ||
554 | #endif /* #ifdef CONFIG_RCU_BOOST */ | ||
553 | int special; | 555 | int special; |
554 | 556 | ||
555 | /* | 557 | /* |
@@ -615,10 +617,10 @@ static noinline void rcu_read_unlock_special(struct task_struct *t) | |||
615 | } | 617 | } |
616 | #ifdef CONFIG_RCU_BOOST | 618 | #ifdef CONFIG_RCU_BOOST |
617 | /* Unboost self if was boosted. */ | 619 | /* Unboost self if was boosted. */ |
618 | if (special & RCU_READ_UNLOCK_BOOSTED) { | 620 | if (t->rcu_boost_mutex != NULL) { |
619 | t->rcu_read_unlock_special &= ~RCU_READ_UNLOCK_BOOSTED; | 621 | rbmp = t->rcu_boost_mutex; |
620 | rt_mutex_unlock(t->rcu_boost_mutex); | ||
621 | t->rcu_boost_mutex = NULL; | 622 | t->rcu_boost_mutex = NULL; |
623 | rt_mutex_unlock(rbmp); | ||
622 | } | 624 | } |
623 | #endif /* #ifdef CONFIG_RCU_BOOST */ | 625 | #endif /* #ifdef CONFIG_RCU_BOOST */ |
624 | local_irq_restore(flags); | 626 | local_irq_restore(flags); |