rcu-tasks: Simplify trc_read_check_handler() atomic operations
authorPaul E. McKenney <paulmck@kernel.org>
Wed, 28 Jul 2021 17:53:41 +0000 (10:53 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 12 Jan 2023 10:58:49 +0000 (11:58 +0100)
commitcd0f597c8aa8fd6128dc4058e33a68427835ae19
treef7653b1788dcb86dc30f1016f66429cae32c49a8
parent593ca696687c70b39041a19fa02917194fee334b
rcu-tasks: Simplify trc_read_check_handler() atomic operations

commit 96017bf9039763a2e02dcc6adaa18592cd73a39d upstream.

Currently, trc_wait_for_one_reader() atomically increments
the trc_n_readers_need_end counter before sending the IPI
invoking trc_read_check_handler().  All failure paths out of
trc_read_check_handler() and also from the smp_call_function_single()
within trc_wait_for_one_reader() must carefully atomically decrement
this counter.  This is more complex than it needs to be.

This commit therefore simplifies things and saves a few lines of
code by dispensing with the atomic decrements in favor of having
trc_read_check_handler() do the atomic increment only in the success case.
In theory, this represents no change in functionality.

Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Cc: Joel Fernandes <joel@joelfernandes.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
kernel/rcu/tasks.h