diff mbox series

[07/16] rcu/nocb: Rename nocb_gp_update_state to nocb_gp_update_state_deoffloading

Message ID 20210128171222.131380-8-frederic@kernel.org
State New
Headers show
Series rcu/nocb updates | expand

Commit Message

Frederic Weisbecker Jan. 28, 2021, 5:12 p.m. UTC
Unconfuse a bit the name of this function which suggests returning true
when the state is updated. It actually returns true when the rdp is in
the process of deoffloading and we must ignore it.

Reported-by: Paul E. McKenney <paulmck@kernel.org>
Cc: Josh Triplett <josh@joshtriplett.org>
Cc: Lai Jiangshan <jiangshanlai@gmail.com>
Cc: Joel Fernandes <joel@joelfernandes.org>
Cc: Neeraj Upadhyay <neeraju@codeaurora.org>
Cc: Boqun Feng <boqun.feng@gmail.com>
Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
---
 kernel/rcu/tree_plugin.h | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

Comments

Paul E. McKenney Jan. 29, 2021, 12:49 a.m. UTC | #1
On Thu, Jan 28, 2021 at 06:12:13PM +0100, Frederic Weisbecker wrote:
> Unconfuse a bit the name of this function which suggests returning true

> when the state is updated. It actually returns true when the rdp is in

> the process of deoffloading and we must ignore it.

> 

> Reported-by: Paul E. McKenney <paulmck@kernel.org>

> Cc: Josh Triplett <josh@joshtriplett.org>

> Cc: Lai Jiangshan <jiangshanlai@gmail.com>

> Cc: Joel Fernandes <joel@joelfernandes.org>

> Cc: Neeraj Upadhyay <neeraju@codeaurora.org>

> Cc: Boqun Feng <boqun.feng@gmail.com>

> Signed-off-by: Frederic Weisbecker <frederic@kernel.org>


Fair point, thank you!  I have queued this one for further review and
testing, with the usual wordsmithing shown below.

							Thanx, Paul

------------------------------------------------------------------------

commit 142d159f544763140e0f498936bca8f71563e0e0
Author: Frederic Weisbecker <frederic@kernel.org>
Date:   Thu Jan 28 18:12:13 2021 +0100

    rcu/nocb: Rename nocb_gp_update_state to nocb_gp_update_state_deoffloading
    
    The name nocb_gp_update_state() is unenlightening, so this commit changes
    it to nocb_gp_update_state_deoffloading().  This function now does what
    its name says, updates state and returns true if the CPU corresponding to
    the specified rcu_data structure is in the process of being de-offloaded.
    
    Reported-by: Paul E. McKenney <paulmck@kernel.org>
    Cc: Josh Triplett <josh@joshtriplett.org>
    Cc: Lai Jiangshan <jiangshanlai@gmail.com>
    Cc: Joel Fernandes <joel@joelfernandes.org>
    Cc: Neeraj Upadhyay <neeraju@codeaurora.org>
    Cc: Boqun Feng <boqun.feng@gmail.com>
    Signed-off-by: Frederic Weisbecker <frederic@kernel.org>

    Signed-off-by: Paul E. McKenney <paulmck@kernel.org>


diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h
index a3db700..9c0ee82 100644
--- a/kernel/rcu/tree_plugin.h
+++ b/kernel/rcu/tree_plugin.h
@@ -2014,7 +2014,8 @@ static inline bool nocb_gp_enabled_cb(struct rcu_data *rdp)
 	return rcu_segcblist_test_flags(&rdp->cblist, flags);
 }
 
-static inline bool nocb_gp_update_state(struct rcu_data *rdp, bool *needwake_state)
+static inline bool nocb_gp_update_state_deoffloading(struct rcu_data *rdp,
+						     bool *needwake_state)
 {
 	struct rcu_segcblist *cblist = &rdp->cblist;
 
@@ -2024,7 +2025,7 @@ static inline bool nocb_gp_update_state(struct rcu_data *rdp, bool *needwake_sta
 			if (rcu_segcblist_test_flags(cblist, SEGCBLIST_KTHREAD_CB))
 				*needwake_state = true;
 		}
-		return true;
+		return false;
 	}
 
 	/*
@@ -2035,7 +2036,7 @@ static inline bool nocb_gp_update_state(struct rcu_data *rdp, bool *needwake_sta
 	rcu_segcblist_clear_flags(cblist, SEGCBLIST_KTHREAD_GP);
 	if (!rcu_segcblist_test_flags(cblist, SEGCBLIST_KTHREAD_CB))
 		*needwake_state = true;
-	return false;
+	return true;
 }
 
 
@@ -2073,7 +2074,7 @@ static void nocb_gp_wait(struct rcu_data *my_rdp)
 			continue;
 		trace_rcu_nocb_wake(rcu_state.name, rdp->cpu, TPS("Check"));
 		rcu_nocb_lock_irqsave(rdp, flags);
-		if (!nocb_gp_update_state(rdp, &needwake_state)) {
+		if (nocb_gp_update_state_deoffloading(rdp, &needwake_state)) {
 			rcu_nocb_unlock_irqrestore(rdp, flags);
 			if (needwake_state)
 				swake_up_one(&rdp->nocb_state_wq);
diff mbox series

Patch

diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h
index 53ff99a18ab1..86c3bcceede6 100644
--- a/kernel/rcu/tree_plugin.h
+++ b/kernel/rcu/tree_plugin.h
@@ -2026,7 +2026,8 @@  static inline bool nocb_gp_enabled_cb(struct rcu_data *rdp)
 	return rcu_segcblist_test_flags(&rdp->cblist, flags);
 }
 
-static inline bool nocb_gp_update_state(struct rcu_data *rdp, bool *needwake_state)
+static inline bool nocb_gp_update_state_deoffloading(struct rcu_data *rdp,
+						     bool *needwake_state)
 {
 	struct rcu_segcblist *cblist = &rdp->cblist;
 
@@ -2036,7 +2037,7 @@  static inline bool nocb_gp_update_state(struct rcu_data *rdp, bool *needwake_sta
 			if (rcu_segcblist_test_flags(cblist, SEGCBLIST_KTHREAD_CB))
 				*needwake_state = true;
 		}
-		return true;
+		return false;
 	}
 
 	/*
@@ -2047,7 +2048,7 @@  static inline bool nocb_gp_update_state(struct rcu_data *rdp, bool *needwake_sta
 	rcu_segcblist_clear_flags(cblist, SEGCBLIST_KTHREAD_GP);
 	if (!rcu_segcblist_test_flags(cblist, SEGCBLIST_KTHREAD_CB))
 		*needwake_state = true;
-	return false;
+	return true;
 }
 
 
@@ -2085,7 +2086,7 @@  static void nocb_gp_wait(struct rcu_data *my_rdp)
 			continue;
 		trace_rcu_nocb_wake(rcu_state.name, rdp->cpu, TPS("Check"));
 		rcu_nocb_lock_irqsave(rdp, flags);
-		if (!nocb_gp_update_state(rdp, &needwake_state)) {
+		if (nocb_gp_update_state_deoffloading(rdp, &needwake_state)) {
 			rcu_nocb_unlock_irqrestore(rdp, flags);
 			if (needwake_state)
 				swake_up_one(&rdp->nocb_state_wq);