[PATCH tip/core/rcu 20/21] rcu/nocb: Code-style nits in callback-offloading toggling

From: paulmck
Date: Tue Jan 05 2021 - 23:51:36 EST


From: "Paul E. McKenney" <paulmck@xxxxxxxxxx>

This commit addresses a few code-style nits in callback-offloading
toggling, including one that predates this toggling.

Cc: Frederic Weisbecker <frederic@xxxxxxxxxx>
Signed-off-by: Paul E. McKenney <paulmck@xxxxxxxxxx>
---
kernel/rcu/rcu_segcblist.h | 19 ++++++-------------
kernel/rcu/tree_plugin.h | 10 +++++-----
2 files changed, 11 insertions(+), 18 deletions(-)

diff --git a/kernel/rcu/rcu_segcblist.h b/kernel/rcu/rcu_segcblist.h
index 3110602..9a19328 100644
--- a/kernel/rcu/rcu_segcblist.h
+++ b/kernel/rcu/rcu_segcblist.h
@@ -80,17 +80,12 @@ static inline bool rcu_segcblist_is_enabled(struct rcu_segcblist *rsclp)
return rcu_segcblist_test_flags(rsclp, SEGCBLIST_ENABLED);
}

-/* Is the specified rcu_segcblist offloaded? */
+/* Is the specified rcu_segcblist offloaded, or is SEGCBLIST_SOFTIRQ_ONLY set? */
static inline bool rcu_segcblist_is_offloaded(struct rcu_segcblist *rsclp)
{
- if (IS_ENABLED(CONFIG_RCU_NOCB_CPU)) {
- /*
- * Complete de-offloading happens only when SEGCBLIST_SOFTIRQ_ONLY
- * is set.
- */
- if (!rcu_segcblist_test_flags(rsclp, SEGCBLIST_SOFTIRQ_ONLY))
- return true;
- }
+ if (IS_ENABLED(CONFIG_RCU_NOCB_CPU) &&
+ !rcu_segcblist_test_flags(rsclp, SEGCBLIST_SOFTIRQ_ONLY))
+ return true;

return false;
}
@@ -99,10 +94,8 @@ static inline bool rcu_segcblist_completely_offloaded(struct rcu_segcblist *rscl
{
int flags = SEGCBLIST_KTHREAD_CB | SEGCBLIST_KTHREAD_GP | SEGCBLIST_OFFLOADED;

- if (IS_ENABLED(CONFIG_RCU_NOCB_CPU)) {
- if ((rsclp->flags & flags) == flags)
- return true;
- }
+ if (IS_ENABLED(CONFIG_RCU_NOCB_CPU) && (rsclp->flags & flags) == flags)
+ return true;

return false;
}
diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h
index bc63a6b..0ad278d 100644
--- a/kernel/rcu/tree_plugin.h
+++ b/kernel/rcu/tree_plugin.h
@@ -2160,11 +2160,11 @@ static inline bool nocb_cb_wait_cond(struct rcu_data *rdp)
static void nocb_cb_wait(struct rcu_data *rdp)
{
struct rcu_segcblist *cblist = &rdp->cblist;
- struct rcu_node *rnp = rdp->mynode;
- bool needwake_state = false;
- bool needwake_gp = false;
unsigned long cur_gp_seq;
unsigned long flags;
+ bool needwake_state = false;
+ bool needwake_gp = false;
+ struct rcu_node *rnp = rdp->mynode;

local_irq_save(flags);
rcu_momentary_dyntick_idle();
@@ -2217,8 +2217,8 @@ static void nocb_cb_wait(struct rcu_data *rdp)
swait_event_interruptible_exclusive(rdp->nocb_cb_wq,
nocb_cb_wait_cond(rdp));

- /* ^^^ Ensure CB invocation follows _sleep test. */
- if (smp_load_acquire(&rdp->nocb_cb_sleep)) {
+ // VVV Ensure CB invocation follows _sleep test.
+ if (smp_load_acquire(&rdp->nocb_cb_sleep)) { // ^^^
WARN_ON(signal_pending(current));
trace_rcu_nocb_wake(rcu_state.name, rdp->cpu, TPS("WokeEmpty"));
}
--
2.9.5