RCU Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH 4/5] rcu: Add missing annotation for rcu_nocb_bypass_lock()
@ 2020-01-20 22:42 Jules Irenge
  0 siblings, 0 replies; only message in thread
From: Jules Irenge @ 2020-01-20 22:42 UTC (permalink / raw)
  To: paulmck
  Cc: rostedt, mathieu.desnoyers, joel, rcu, iangshanlai, boqun.feng,
	linux-kernel, Jules Irenge

Sparse reports warning at rcu_nocb_bypass_lock()

|warning: context imbalance in rcu_nocb_bypass_lock() - wrong count at exit

To fix this, an __acquires(&rdp->nocb_bypass_lock) is added.
Given that rcu_nocb_bypass_lock() does actually
call raw_spin_lock(&rdp->nocb_bypass_lock)
in case raw_spin_trylock(&rdp->nocb_bypass_lock) fails.
This not only fixes the warning
but also improves on the readability of the code.

Signed-off-by: Jules Irenge <jbi.octave@gmail.com>
 kernel/rcu/tree_plugin.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h
index fa08d55f7040..7689e649b674 100644
--- a/kernel/rcu/tree_plugin.h
+++ b/kernel/rcu/tree_plugin.h
@@ -1510,6 +1510,7 @@ module_param(nocb_nobypass_lim_per_jiffy, int, 0);
  * flag the contention.
 static void rcu_nocb_bypass_lock(struct rcu_data *rdp)
+	__acquires(&rdp->nocb_bypass_lock)
 	if (raw_spin_trylock(&rdp->nocb_bypass_lock))

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, back to index

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-20 22:42 [PATCH 4/5] rcu: Add missing annotation for rcu_nocb_bypass_lock() Jules Irenge

RCU Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/rcu/0 rcu/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 rcu rcu/ https://lore.kernel.org/rcu \
	public-inbox-index rcu

Example config snippet for mirrors

Newsgroup available over NNTP:

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git