From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: linux-kernel@vger.kernel.org
Cc: mingo@kernel.org, laijs@cn.fujitsu.com, dipankar@in.ibm.com,
akpm@linux-foundation.org, mathieu.desnoyers@efficios.com,
josh@joshtriplett.org, niv@us.ibm.com, tglx@linutronix.de,
peterz@infradead.org, rostedt@goodmis.org, dhowells@redhat.com,
edumazet@google.com, darren@dvhart.com, fweisbec@gmail.com,
oleg@redhat.com, sbw@mit.edu,
"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Subject: [PATCH tip/core/rcu 04/19] rcu: Update cpu_needs_another_gp() for futures from non-NOCB CPUs
Date: Mon, 28 Apr 2014 16:56:17 -0700 [thread overview]
Message-ID: <1398729392-15087-4-git-send-email-paulmck@linux.vnet.ibm.com> (raw)
In-Reply-To: <1398729392-15087-1-git-send-email-paulmck@linux.vnet.ibm.com>
From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
In the old days, the only source of requests for future grace periods
was NOCB CPUs. This has changed: CPUs routinely post requests for
future grace periods in order to promote power efficiency and reduce
OS jitter with minimal impact on grace-period latency. This commit
therefore updates cpu_needs_another_gp() to invoke rcu_future_needs_gp()
instead of rcu_nocb_needs_gp(). The latter is no longer used, so is
now removed. This commit also adds tracing for the irq_work_queue()
wakeup case.
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---
kernel/rcu/tree.c | 39 +++++++++++++++++++++++++++++----------
kernel/rcu/tree.h | 1 -
kernel/rcu/tree_plugin.h | 18 ------------------
3 files changed, 29 insertions(+), 29 deletions(-)
diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index b33c29a99df3..b4688993e956 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -324,6 +324,28 @@ cpu_has_callbacks_ready_to_invoke(struct rcu_data *rdp)
}
/*
+ * Return the root node of the specified rcu_state structure.
+ */
+static struct rcu_node *rcu_get_root(struct rcu_state *rsp)
+{
+ return &rsp->node[0];
+}
+
+/*
+ * Is there any need for future grace periods?
+ * Interrupts must be disabled. If the caller does not hold the root
+ * rnp_node structure's ->lock, the results are advisory only.
+ */
+static int rcu_future_needs_gp(struct rcu_state *rsp)
+{
+ struct rcu_node *rnp = rcu_get_root(rsp);
+ int idx = (ACCESS_ONCE(rnp->completed) + 1) & 0x1;
+ int *fp = &rnp->need_future_gp[idx];
+
+ return ACCESS_ONCE(*fp);
+}
+
+/*
* Does the current CPU require a not-yet-started grace period?
* The caller must have disabled interrupts to prevent races with
* normal callback registry.
@@ -335,7 +357,7 @@ cpu_needs_another_gp(struct rcu_state *rsp, struct rcu_data *rdp)
if (rcu_gp_in_progress(rsp))
return 0; /* No, a grace period is already in progress. */
- if (rcu_nocb_needs_gp(rsp))
+ if (rcu_future_needs_gp(rsp))
return 1; /* Yes, a no-CBs CPU needs one. */
if (!rdp->nxttail[RCU_NEXT_TAIL])
return 0; /* No, this is a no-CBs (or offline) CPU. */
@@ -350,14 +372,6 @@ cpu_needs_another_gp(struct rcu_state *rsp, struct rcu_data *rdp)
}
/*
- * Return the root node of the specified rcu_state structure.
- */
-static struct rcu_node *rcu_get_root(struct rcu_state *rsp)
-{
- return &rsp->node[0];
-}
-
-/*
* rcu_eqs_enter_common - current CPU is moving towards extended quiescent state
*
* If the new value of the ->dynticks_nesting counter now is zero,
@@ -1672,6 +1686,8 @@ static void rsp_wakeup(struct irq_work *work)
/* Wake up rcu_gp_kthread() to start the grace period. */
wake_up(&rsp->gp_wq);
+ trace_rcu_grace_period(rsp->name, ACCESS_ONCE(rsp->gpnum),
+ "Workqueuewoken");
}
/*
@@ -1706,8 +1722,11 @@ rcu_start_gp_advanced(struct rcu_state *rsp, struct rcu_node *rnp,
* the wakeup to interrupt context. And don't bother waking
* up the running kthread.
*/
- if (current != rsp->gp_kthread)
+ if (current != rsp->gp_kthread) {
+ trace_rcu_grace_period(rsp->name, ACCESS_ONCE(rsp->gpnum),
+ "Workqueuewake");
irq_work_queue(&rsp->wakeup_work);
+ }
}
/*
diff --git a/kernel/rcu/tree.h b/kernel/rcu/tree.h
index 75dc3c39a02a..7b572c5c65e1 100644
--- a/kernel/rcu/tree.h
+++ b/kernel/rcu/tree.h
@@ -547,7 +547,6 @@ static void print_cpu_stall_info(struct rcu_state *rsp, int cpu);
static void print_cpu_stall_info_end(void);
static void zero_cpu_stall_ticks(struct rcu_data *rdp);
static void increment_cpu_stall_ticks(void);
-static int rcu_nocb_needs_gp(struct rcu_state *rsp);
static void rcu_nocb_gp_set(struct rcu_node *rnp, int nrq);
static void rcu_nocb_gp_cleanup(struct rcu_state *rsp, struct rcu_node *rnp);
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 f9c9057239a9..f60dd6ea8333 100644
--- a/kernel/rcu/tree_plugin.h
+++ b/kernel/rcu/tree_plugin.h
@@ -2068,19 +2068,6 @@ static int __init parse_rcu_nocb_poll(char *arg)
early_param("rcu_nocb_poll", parse_rcu_nocb_poll);
/*
- * Do any no-CBs CPUs need another grace period?
- *
- * Interrupts must be disabled. If the caller does not hold the root
- * rnp_node structure's ->lock, the results are advisory only.
- */
-static int rcu_nocb_needs_gp(struct rcu_state *rsp)
-{
- struct rcu_node *rnp = rcu_get_root(rsp);
-
- return rnp->need_future_gp[(ACCESS_ONCE(rnp->completed) + 1) & 0x1];
-}
-
-/*
* Wake up any no-CBs CPUs' kthreads that were waiting on the just-ended
* grace period.
*/
@@ -2402,11 +2389,6 @@ static bool init_nocb_callback_list(struct rcu_data *rdp)
#else /* #ifdef CONFIG_RCU_NOCB_CPU */
-static int rcu_nocb_needs_gp(struct rcu_state *rsp)
-{
- return 0;
-}
-
static void rcu_nocb_gp_cleanup(struct rcu_state *rsp, struct rcu_node *rnp)
{
}
--
1.8.1.5
next prev parent reply other threads:[~2014-04-29 0:03 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-28 23:56 [PATCH tip/core/rcu 0/3] Miscellaneous fixes for 3.16 Paul E. McKenney
2014-04-28 23:56 ` [PATCH tip/core/rcu 01/19] rcu: Protect ->gp_flags accesses with ACCESS_ONCE() Paul E. McKenney
2014-04-28 23:56 ` [PATCH tip/core/rcu 02/19] rcu: Fix incorrect notes for code Paul E. McKenney
2014-04-28 23:56 ` [PATCH tip/core/rcu 03/19] rcu: Print negatives for stall-warning counter wraparound Paul E. McKenney
2014-04-28 23:56 ` Paul E. McKenney [this message]
2014-04-28 23:56 ` [PATCH tip/core/rcu 05/19] rcu: Remove unused rcu_data structure field Paul E. McKenney
2014-04-28 23:56 ` [PATCH tip/core/rcu 06/19] rcu: Protect uses of jiffies_stall field with ACCESS_ONCE() Paul E. McKenney
2014-04-28 23:56 ` [PATCH tip/core/rcu 07/19] rcu: Make callers awaken grace-period kthread Paul E. McKenney
2014-04-28 23:56 ` [PATCH tip/core/rcu 08/19] rcu: Remove "extern" from function declaration in include/linux/rcupdate.h Paul E. McKenney
2014-04-28 23:56 ` [PATCH tip/core/rcu 09/19] rcu: Protect uses of ->jiffies_stall with ACCESS_ONCE() Paul E. McKenney
2014-04-28 23:56 ` [PATCH tip/core/rcu 10/19] rcu: Add event tracing to dyntick_save_progress_counter() Paul E. McKenney
2014-04-28 23:56 ` [PATCH tip/core/rcu 11/19] rcu: Replace NR_CPUS with nr_cpu_ids Paul E. McKenney
2014-04-28 23:56 ` [PATCH tip/core/rcu 12/19] rcu: Consolidate kfree_call_rcu() to use rcu_state pointer Paul E. McKenney
2014-04-28 23:56 ` [PATCH tip/core/rcu 13/19] rcu: Merge rcu_sched_force_quiescent_state() with rcu_force_quiescent_state() Paul E. McKenney
2014-04-28 23:56 ` [PATCH tip/core/rcu 14/19] rcu: Document RCU_INIT_POINTER()'s lack of ordering guarantees Paul E. McKenney
2014-04-28 23:56 ` [PATCH tip/core/rcu 15/19] rcu: Bind RCU grace-period kthreads if NO_HZ_FULL Paul E. McKenney
2014-04-28 23:56 ` [PATCH tip/core/rcu 16/19] rcu: Make large and small sysidle systems use same state machine Paul E. McKenney
2014-04-28 23:56 ` [PATCH tip/core/rcu 17/19] rcu: Remove duplicate resched_cpu() declaration Paul E. McKenney
2014-04-28 23:56 ` [PATCH tip/core/rcu 18/19] rcu: Replace __this_cpu_ptr() uses with raw_cpu_ptr() Paul E. McKenney
2014-04-28 23:56 ` [PATCH tip/core/rcu 19/19] softirq: A single rcu_bh_qs() call per softirq set is enough Paul E. McKenney
2014-04-29 3:23 ` [PATCH tip/core/rcu 0/3] Miscellaneous fixes for 3.16 Josh Triplett
2014-04-29 15:46 ` Paul E. McKenney
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=1398729392-15087-4-git-send-email-paulmck@linux.vnet.ibm.com \
--to=paulmck@linux.vnet.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=darren@dvhart.com \
--cc=dhowells@redhat.com \
--cc=dipankar@in.ibm.com \
--cc=edumazet@google.com \
--cc=fweisbec@gmail.com \
--cc=josh@joshtriplett.org \
--cc=laijs@cn.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mingo@kernel.org \
--cc=niv@us.ibm.com \
--cc=oleg@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=sbw@mit.edu \
--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
all inboxes | Powered by JetHome®