Skip to content

Commit a10e3cb

Browse files
linke liurezki
authored andcommitted
rcutorture: Re-use value stored to ->rtort_pipe_count instead of re-reading
Currently, the rcu_torture_pipe_update_one() writes the value (i + 1) to rp->rtort_pipe_count, then immediately re-reads it in order to compare it to RCU_TORTURE_PIPE_LEN. This re-read is pointless because no other update to rp->rtort_pipe_count can occur at this point. This commit therefore instead re-uses the (i + 1) value stored in the comparison instead of re-reading rp->rtort_pipe_count. Signed-off-by: linke li <lilinke99@qq.com> Reviewed-by: Joel Fernandes (Google) <joel@joelfernandes.org> Signed-off-by: Paul E. McKenney <paulmck@kernel.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
1 parent 8b9b443 commit a10e3cb

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

kernel/rcu/rcutorture.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ rcu_torture_pipe_update_one(struct rcu_torture *rp)
467467
atomic_inc(&rcu_torture_wcount[i]);
468468
WRITE_ONCE(rp->rtort_pipe_count, i + 1);
469469
ASSERT_EXCLUSIVE_WRITER(rp->rtort_pipe_count);
470-
if (rp->rtort_pipe_count >= RCU_TORTURE_PIPE_LEN) {
470+
if (i + 1 >= RCU_TORTURE_PIPE_LEN) {
471471
rp->rtort_mbtest = 0;
472472
return true;
473473
}

0 commit comments

Comments
 (0)