diff options
| -rw-r--r-- | kernel/rcu/tree.c | 16 | ||||
| -rw-r--r-- | kernel/rcu/tree.h | 1 | ||||
| -rw-r--r-- | kernel/rcu/tree_plugin.h | 17 |
3 files changed, 10 insertions, 24 deletions
diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index 497f139056c7..afc5e32f0da4 100644 --- a/kernel/rcu/tree.c +++ b/kernel/rcu/tree.c | |||
| @@ -1763,14 +1763,14 @@ out: | |||
| 1763 | * Clean up any old requests for the just-ended grace period. Also return | 1763 | * Clean up any old requests for the just-ended grace period. Also return |
| 1764 | * whether any additional grace periods have been requested. | 1764 | * whether any additional grace periods have been requested. |
| 1765 | */ | 1765 | */ |
| 1766 | static int rcu_future_gp_cleanup(struct rcu_state *rsp, struct rcu_node *rnp) | 1766 | static bool rcu_future_gp_cleanup(struct rcu_state *rsp, struct rcu_node *rnp) |
| 1767 | { | 1767 | { |
| 1768 | int c = rnp->completed; | 1768 | int c = rnp->completed; |
| 1769 | int needmore; | 1769 | bool needmore; |
| 1770 | struct rcu_data *rdp = this_cpu_ptr(rsp->rda); | 1770 | struct rcu_data *rdp = this_cpu_ptr(rsp->rda); |
| 1771 | 1771 | ||
| 1772 | need_future_gp_element(rnp, c) = 0; | 1772 | need_future_gp_element(rnp, c) = 0; |
| 1773 | needmore = need_future_gp_element(rnp, c + 1); | 1773 | needmore = need_any_future_gp(rnp); |
| 1774 | trace_rcu_future_gp(rnp, rdp, c, | 1774 | trace_rcu_future_gp(rnp, rdp, c, |
| 1775 | needmore ? TPS("CleanupMore") : TPS("Cleanup")); | 1775 | needmore ? TPS("CleanupMore") : TPS("Cleanup")); |
| 1776 | return needmore; | 1776 | return needmore; |
| @@ -2113,7 +2113,6 @@ static void rcu_gp_cleanup(struct rcu_state *rsp) | |||
| 2113 | { | 2113 | { |
| 2114 | unsigned long gp_duration; | 2114 | unsigned long gp_duration; |
| 2115 | bool needgp = false; | 2115 | bool needgp = false; |
| 2116 | int nocb = 0; | ||
| 2117 | struct rcu_data *rdp; | 2116 | struct rcu_data *rdp; |
| 2118 | struct rcu_node *rnp = rcu_get_root(rsp); | 2117 | struct rcu_node *rnp = rcu_get_root(rsp); |
| 2119 | struct swait_queue_head *sq; | 2118 | struct swait_queue_head *sq; |
| @@ -2152,7 +2151,7 @@ static void rcu_gp_cleanup(struct rcu_state *rsp) | |||
| 2152 | if (rnp == rdp->mynode) | 2151 | if (rnp == rdp->mynode) |
| 2153 | needgp = __note_gp_changes(rsp, rnp, rdp) || needgp; | 2152 | needgp = __note_gp_changes(rsp, rnp, rdp) || needgp; |
| 2154 | /* smp_mb() provided by prior unlock-lock pair. */ | 2153 | /* smp_mb() provided by prior unlock-lock pair. */ |
| 2155 | nocb += rcu_future_gp_cleanup(rsp, rnp); | 2154 | needgp = rcu_future_gp_cleanup(rsp, rnp) || needgp; |
| 2156 | sq = rcu_nocb_gp_get(rnp); | 2155 | sq = rcu_nocb_gp_get(rnp); |
| 2157 | raw_spin_unlock_irq_rcu_node(rnp); | 2156 | raw_spin_unlock_irq_rcu_node(rnp); |
| 2158 | rcu_nocb_gp_cleanup(sq); | 2157 | rcu_nocb_gp_cleanup(sq); |
| @@ -2162,13 +2161,18 @@ static void rcu_gp_cleanup(struct rcu_state *rsp) | |||
| 2162 | } | 2161 | } |
| 2163 | rnp = rcu_get_root(rsp); | 2162 | rnp = rcu_get_root(rsp); |
| 2164 | raw_spin_lock_irq_rcu_node(rnp); /* Order GP before ->completed update. */ | 2163 | raw_spin_lock_irq_rcu_node(rnp); /* Order GP before ->completed update. */ |
| 2165 | rcu_nocb_gp_set(rnp, nocb); | ||
| 2166 | 2164 | ||
| 2167 | /* Declare grace period done. */ | 2165 | /* Declare grace period done. */ |
| 2168 | WRITE_ONCE(rsp->completed, rsp->gpnum); | 2166 | WRITE_ONCE(rsp->completed, rsp->gpnum); |
| 2169 | trace_rcu_grace_period(rsp->name, rsp->completed, TPS("end")); | 2167 | trace_rcu_grace_period(rsp->name, rsp->completed, TPS("end")); |
| 2170 | rsp->gp_state = RCU_GP_IDLE; | 2168 | rsp->gp_state = RCU_GP_IDLE; |
| 2169 | /* Check for GP requests since above loop. */ | ||
| 2171 | rdp = this_cpu_ptr(rsp->rda); | 2170 | rdp = this_cpu_ptr(rsp->rda); |
| 2171 | if (need_any_future_gp(rnp)) { | ||
| 2172 | trace_rcu_future_gp(rnp, rdp, rsp->completed - 1, | ||
| 2173 | TPS("CleanupMore")); | ||
| 2174 | needgp = true; | ||
| 2175 | } | ||
| 2172 | /* Advance CBs to reduce false positives below. */ | 2176 | /* Advance CBs to reduce false positives below. */ |
| 2173 | needgp = rcu_advance_cbs(rsp, rnp, rdp) || needgp; | 2177 | needgp = rcu_advance_cbs(rsp, rnp, rdp) || needgp; |
| 2174 | if (needgp || cpu_needs_another_gp(rsp, rdp)) { | 2178 | if (needgp || cpu_needs_another_gp(rsp, rdp)) { |
diff --git a/kernel/rcu/tree.h b/kernel/rcu/tree.h index 18b091474ffa..bd1103763551 100644 --- a/kernel/rcu/tree.h +++ b/kernel/rcu/tree.h | |||
| @@ -469,7 +469,6 @@ static void print_cpu_stall_info_end(void); | |||
| 469 | static void zero_cpu_stall_ticks(struct rcu_data *rdp); | 469 | static void zero_cpu_stall_ticks(struct rcu_data *rdp); |
| 470 | static void increment_cpu_stall_ticks(void); | 470 | static void increment_cpu_stall_ticks(void); |
| 471 | static bool rcu_nocb_cpu_needs_barrier(struct rcu_state *rsp, int cpu); | 471 | static bool rcu_nocb_cpu_needs_barrier(struct rcu_state *rsp, int cpu); |
| 472 | static void rcu_nocb_gp_set(struct rcu_node *rnp, int nrq); | ||
| 473 | static struct swait_queue_head *rcu_nocb_gp_get(struct rcu_node *rnp); | 472 | static struct swait_queue_head *rcu_nocb_gp_get(struct rcu_node *rnp); |
| 474 | static void rcu_nocb_gp_cleanup(struct swait_queue_head *sq); | 473 | static void rcu_nocb_gp_cleanup(struct swait_queue_head *sq); |
| 475 | static void rcu_init_one_nocb(struct rcu_node *rnp); | 474 | static void rcu_init_one_nocb(struct rcu_node *rnp); |
diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h index 640ea927d8a4..313b77d9cf06 100644 --- a/kernel/rcu/tree_plugin.h +++ b/kernel/rcu/tree_plugin.h | |||
| @@ -1780,19 +1780,6 @@ static void rcu_nocb_gp_cleanup(struct swait_queue_head *sq) | |||
| 1780 | swake_up_all(sq); | 1780 | swake_up_all(sq); |
| 1781 | } | 1781 | } |
| 1782 | 1782 | ||
| 1783 | /* | ||
| 1784 | * Set the root rcu_node structure's ->need_future_gp field | ||
| 1785 | * based on the sum of those of all rcu_node structures. This does | ||
| 1786 | * double-count the root rcu_node structure's requests, but this | ||
| 1787 | * is necessary to handle the possibility of a rcu_nocb_kthread() | ||
| 1788 | * having awakened during the time that the rcu_node structures | ||
| 1789 | * were being updated for the end of the previous grace period. | ||
| 1790 | */ | ||
| 1791 | static void rcu_nocb_gp_set(struct rcu_node *rnp, int nrq) | ||
| 1792 | { | ||
| 1793 | need_future_gp_element(rnp, rnp->completed + 1) += nrq; | ||
| 1794 | } | ||
| 1795 | |||
| 1796 | static struct swait_queue_head *rcu_nocb_gp_get(struct rcu_node *rnp) | 1783 | static struct swait_queue_head *rcu_nocb_gp_get(struct rcu_node *rnp) |
| 1797 | { | 1784 | { |
| 1798 | return &rnp->nocb_gp_wq[rnp->completed & 0x1]; | 1785 | return &rnp->nocb_gp_wq[rnp->completed & 0x1]; |
| @@ -2495,10 +2482,6 @@ static void rcu_nocb_gp_cleanup(struct swait_queue_head *sq) | |||
| 2495 | { | 2482 | { |
| 2496 | } | 2483 | } |
| 2497 | 2484 | ||
| 2498 | static void rcu_nocb_gp_set(struct rcu_node *rnp, int nrq) | ||
| 2499 | { | ||
| 2500 | } | ||
| 2501 | |||
| 2502 | static struct swait_queue_head *rcu_nocb_gp_get(struct rcu_node *rnp) | 2485 | static struct swait_queue_head *rcu_nocb_gp_get(struct rcu_node *rnp) |
| 2503 | { | 2486 | { |
| 2504 | return NULL; | 2487 | return NULL; |
