linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Frederic Weisbecker <fweisbec@gmail.com>
To: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
	Ingo Molnar <mingo@elte.hu>, Thomas Gleixner <tglx@linutronix.de>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Steven Rostedt <rostedt@goodmis.org>
Subject: [PATCH 1/2] rcu: Stop chasing QS if another CPU did it for us
Date: Fri, 10 Dec 2010 22:11:10 +0100	[thread overview]
Message-ID: <1292015471-19227-2-git-send-email-fweisbec@gmail.com> (raw)
In-Reply-To: <1292015471-19227-1-git-send-email-fweisbec@gmail.com>

When a CPU is idle and others CPUs handled its extended
quiescent state to complete grace periods on its behalf,
it will catch up with completed grace periods numbers
when it wakes up.

But at this point there might be no more grace period to
complete, but still the woken CPU always keeps its stale
qs_pending value and will then continue to chase quiescent
states even if its not needed anymore.

This results in clusters of spurious softirqs until a new
real grace period is started. Because if we continue to
chase quiescent states but we have completed every grace
periods, rcu_report_qs_rdp() is puzzled and makes that
state run into infinite loops.

As suggested by Lai Jiangshan, just reset qs_pending if
someone completed every grace periods on our behalf.

Suggested-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Steven Rostedt <rostedt@goodmis.org>
---
 kernel/rcutree.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/kernel/rcutree.c b/kernel/rcutree.c
index ccdc04c..8c4ed60 100644
--- a/kernel/rcutree.c
+++ b/kernel/rcutree.c
@@ -681,6 +681,14 @@ __rcu_process_gp_end(struct rcu_state *rsp, struct rcu_node *rnp, struct rcu_dat
 
 		/* Remember that we saw this grace-period completion. */
 		rdp->completed = rnp->completed;
+
+		/*
+		 * If another CPU handled our extended quiescent states and
+		 * we have no more grace period to complete yet, then stop
+		 * chasing quiescent states.
+		 */
+		if (rdp->completed == rnp->gpnum)
+			rdp->qs_pending = 0;
 	}
 }
 
-- 
1.7.3.2


  reply	other threads:[~2010-12-10 21:11 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-10 21:11 [PATCH 0/2 v2] rcu: Fix series of spurious RCU softirqs Frederic Weisbecker
2010-12-10 21:11 ` Frederic Weisbecker [this message]
2010-12-10 22:58   ` [PATCH 1/2] rcu: Stop chasing QS if another CPU did it for us Paul E. McKenney
2010-12-10 23:33     ` Frederic Weisbecker
2010-12-10 21:14 ` [PATCH 0/2 v2] rcu: Fix series of spurious RCU softirqs Frederic Weisbecker
     [not found] ` <1292015471-19227-3-git-send-email-fweisbec@gmail.com>
2010-12-10 23:02   ` [PATCH 2/2] rcu: Keep gpnum and completed fields synchronized Paul E. McKenney
2010-12-10 23:39     ` Paul E. McKenney
2010-12-10 23:47       ` Frederic Weisbecker
2010-12-11  0:04         ` Paul E. McKenney
2010-12-11  0:15           ` Frederic Weisbecker
2010-12-11  0:58             ` Paul E. McKenney
2010-12-11  1:21               ` Frederic Weisbecker
2010-12-11  6:36                 ` Paul E. McKenney
2010-12-11  0:00     ` Frederic Weisbecker
2010-12-11  0:48       ` Paul E. McKenney
2010-12-11  0:51         ` Frederic Weisbecker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1292015471-19227-2-git-send-email-fweisbec@gmail.com \
    --to=fweisbec@gmail.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).