aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/rcutree.c
diff options
context:
space:
mode:
authorPaul E. McKenney <paulmck@linux.vnet.ibm.com>2010-12-10 18:02:47 -0500
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>2010-12-17 15:34:20 -0500
commit121dfc4b3eba9e2f3c42d35205a3510cc65b9931 (patch)
treebd132a839cf3618f1d7602efbb1e144a8e04cec4 /kernel/rcutree.c
parent5ff8e6f0535fe730e921ca347bc38dcb9e01791a (diff)
rcu: fine-tune grace-period begin/end checks
Use the CPU's bit in rnp->qsmask to determine whether or not the CPU should try to report a quiescent state. Handle overflow in the check for rdp->gpnum having fallen behind. Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Diffstat (limited to 'kernel/rcutree.c')
-rw-r--r--kernel/rcutree.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/kernel/rcutree.c b/kernel/rcutree.c
index 8105271fc10e..c39ec5b4ae82 100644
--- a/kernel/rcutree.c
+++ b/kernel/rcutree.c
@@ -617,9 +617,17 @@ static void __init check_cpu_stall_init(void)
617static void __note_new_gpnum(struct rcu_state *rsp, struct rcu_node *rnp, struct rcu_data *rdp) 617static void __note_new_gpnum(struct rcu_state *rsp, struct rcu_node *rnp, struct rcu_data *rdp)
618{ 618{
619 if (rdp->gpnum != rnp->gpnum) { 619 if (rdp->gpnum != rnp->gpnum) {
620 rdp->qs_pending = 1; 620 /*
621 rdp->passed_quiesc = 0; 621 * If the current grace period is waiting for this CPU,
622 * set up to detect a quiescent state, otherwise don't
623 * go looking for one.
624 */
622 rdp->gpnum = rnp->gpnum; 625 rdp->gpnum = rnp->gpnum;
626 if (rnp->qsmask & rdp->grpmask) {
627 rdp->qs_pending = 1;
628 rdp->passed_quiesc = 0;
629 } else
630 rdp->qs_pending = 0;
623 } 631 }
624} 632}
625 633
@@ -681,19 +689,20 @@ __rcu_process_gp_end(struct rcu_state *rsp, struct rcu_node *rnp, struct rcu_dat
681 689
682 /* 690 /*
683 * If we were in an extended quiescent state, we may have 691 * If we were in an extended quiescent state, we may have
684 * missed some grace periods that others CPUs took care on 692 * missed some grace periods that others CPUs handled on
685 * our behalf. Catch up with this state to avoid noting 693 * our behalf. Catch up with this state to avoid noting
686 * spurious new grace periods. 694 * spurious new grace periods. If another grace period
695 * has started, then rnp->gpnum will have advanced, so
696 * we will detect this later on.
687 */ 697 */
688 if (rdp->completed > rdp->gpnum) 698 if (ULONG_CMP_LT(rdp->gpnum, rdp->completed))
689 rdp->gpnum = rdp->completed; 699 rdp->gpnum = rdp->completed;
690 700
691 /* 701 /*
692 * If another CPU handled our extended quiescent states and 702 * If RCU does not need a quiescent state from this CPU,
693 * we have no more grace period to complete yet, then stop 703 * then make sure that this CPU doesn't go looking for one.
694 * chasing quiescent states.
695 */ 704 */
696 if (rdp->completed == rnp->gpnum) 705 if ((rnp->qsmask & rdp->grpmask) == 0)
697 rdp->qs_pending = 0; 706 rdp->qs_pending = 0;
698 } 707 }
699} 708}