[tip: core/rcu] rcu: Add missing annotation for exit_tasks_rcu_start()

From: tip-bot2 for Jules Irenge
Date: Tue Mar 24 2020 - 05:19:02 EST


The following commit has been merged into the core/rcu branch of tip:

Commit-ID: e1e9bdc00ade6651c11bf5628ee9d313ee6089ac
Gitweb: https://git.kernel.org/tip/e1e9bdc00ade6651c11bf5628ee9d313ee6089ac
Author: Jules Irenge <jbi.octave@xxxxxxxxx>
AuthorDate: Mon, 20 Jan 2020 22:41:26
Committer: Paul E. McKenney <paulmck@xxxxxxxxxx>
CommitterDate: Thu, 20 Feb 2020 16:00:45 -08:00

rcu: Add missing annotation for exit_tasks_rcu_start()

Sparse reports a warning at exit_tasks_rcu_start(void)

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

To fix this, this commit adds an __acquires(&tasks_rcu_exit_srcu).
Given that exit_tasks_rcu_start() does actually call __srcu_read_lock(),
this not only fixes the warning but also improves on the readability of
the code.

Signed-off-by: Jules Irenge <jbi.octave@xxxxxxxxx>
Signed-off-by: Paul E. McKenney <paulmck@xxxxxxxxxx>
Reviewed-by: Joel Fernandes (Google) <joel@xxxxxxxxxxxxxxxxx>
---
kernel/rcu/update.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/rcu/update.c b/kernel/rcu/update.c
index a27df76..a04fe54 100644
--- a/kernel/rcu/update.c
+++ b/kernel/rcu/update.c
@@ -801,7 +801,7 @@ static int __init rcu_spawn_tasks_kthread(void)
core_initcall(rcu_spawn_tasks_kthread);

/* Do the srcu_read_lock() for the above synchronize_srcu(). */
-void exit_tasks_rcu_start(void)
+void exit_tasks_rcu_start(void) __acquires(&tasks_rcu_exit_srcu)
{
preempt_disable();
current->rcu_tasks_idx = __srcu_read_lock(&tasks_rcu_exit_srcu);