From: Joe Korty <joe.korty@ccur.com>
To: paulmck@linux.vnet.ibm.com
Cc: fweisbec@gmail.com, peterz@infradead.org, laijs@cn.fujitsu.com,
mathieu.desnoyers@efficios.com, dhowells@redhat.com,
loic.minier@linaro.org, dhaval.giani@gmail.com,
tglx@linutronix.de, josh@joshtriplett.org,
houston.jim@comcast.net, andi@firstfloor.org,
linux-kernel@vger.kernel.org
Subject: [PATCH 14/24] jrcu: add a stallout detector
Date: Thu, 24 Mar 2011 13:48:02 -0400 [thread overview]
Message-ID: <20110324174802.GA18900@tsunami.ccur.com> (raw)
jrcu: create a stallout detector.
Tickle stalled-out cpus whenever too much time has
passed since the last time a batch has been retired.
For efficiency, and to protect the dedicated cpu model as
much as possible, only cpus contributing to the stallout
are tickled.
If the tickle is not effective, then JRCU will remain
stalled out forever. This will eventually lead to an
out-of-memory condition.
On the other hand, if the tickle is not effective,
that means some CPU is broken. It isn't leaving
preempt-protected code, and as long as that is true we
cannot retire batches with a clear conscience.
Signed-off-by: Joe Korty <joe.korty@ccur.com>
Index: b/include/linux/sched.h
===================================================================
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1903,6 +1903,8 @@ extern void wake_up_idle_cpu(int cpu);
static inline void wake_up_idle_cpu(int cpu) { }
#endif
+extern void force_cpu_resched(int cpu);
+
extern unsigned int sysctl_sched_latency;
extern unsigned int sysctl_sched_min_granularity;
extern unsigned int sysctl_sched_wakeup_granularity;
Index: b/kernel/sched.c
===================================================================
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -1183,6 +1183,16 @@ static void resched_cpu(int cpu)
raw_spin_unlock_irqrestore(&rq->lock, flags);
}
+void force_cpu_resched(int cpu)
+{
+ struct rq *rq = cpu_rq(cpu);
+ unsigned long flags;
+
+ raw_spin_lock_irqsave(&rq->lock, flags);
+ resched_task(cpu_curr(cpu));
+ raw_spin_unlock_irqrestore(&rq->lock, flags);
+}
+
#ifdef CONFIG_NO_HZ
/*
* In the semi idle case, use the nearest busy cpu for migrating timers
@@ -1288,6 +1298,11 @@ static void sched_rt_avg_update(struct r
static void sched_avg_update(struct rq *rq)
{
}
+
+void force_cpu_resched(int cpu)
+{
+ set_need_resched();
+}
#endif /* CONFIG_SMP */
#if BITS_PER_LONG == 32
Index: b/kernel/jrcu.c
===================================================================
--- a/kernel/jrcu.c
+++ b/kernel/jrcu.c
@@ -324,26 +324,29 @@ static void __rcu_delimit_batches(struct
/*
* Force end-of-batch if too much time (n seconds) has
- * gone by. The forcing method is slightly questionable,
- * hence the WARN_ON.
+ * gone by.
*/
rcu_now = sched_clock();
if (!eob && !rcu_timestamp
&& ((rcu_now - rcu_timestamp) > (s64)rcu_wdog * NSEC_PER_SEC)) {
rcu_stats.nforced++;
- WARN_ON_ONCE(1);
- eob = 1;
+ for_each_online_cpu(cpu) {
+ if (rcu_data[cpu].wait)
+ force_cpu_resched(cpu);
+ }
+ rcu_timestamp = rcu_now;
}
-
/*
* Just return if the current batch has not yet
- * ended. Also, keep track of just how long it
- * has been since we've actually seen end-of-batch.
+ * ended.
*/
if (!eob)
return;
+ /*
+ * Batch has ended. First, restart watchdog.
+ */
rcu_timestamp = rcu_now;
/*
reply other threads:[~2011-03-24 17:51 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20110324174802.GA18900@tsunami.ccur.com \
--to=joe.korty@ccur.com \
--cc=andi@firstfloor.org \
--cc=dhaval.giani@gmail.com \
--cc=dhowells@redhat.com \
--cc=fweisbec@gmail.com \
--cc=houston.jim@comcast.net \
--cc=josh@joshtriplett.org \
--cc=laijs@cn.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=loic.minier@linaro.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=paulmck@linux.vnet.ibm.com \
--cc=peterz@infradead.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
Powered by JetHome