Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0ae94e00 authored by Paul E. McKenney's avatar Paul E. McKenney
Browse files

rcu: Make rcu_future_needs_gp() check all ->need_future_gps[] elements



Currently, the rcu_future_needs_gp() function checks only the current
element of the ->need_future_gps[] array, which might miss elements that
were offset from the expected element, for example, due to races with
the start or the end of a grace period.  This commit therefore makes
rcu_future_needs_gp() use the need_any_future_gp() macro to check all
of the elements of this array.

Signed-off-by: default avatarPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Tested-by: default avatarNicholas Piggin <npiggin@gmail.com>
parent 51af970d
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -720,7 +720,7 @@ static int rcu_future_needs_gp(struct rcu_state *rsp)
	struct rcu_node *rnp = rcu_get_root(rsp);

	lockdep_assert_irqs_disabled();
	return READ_ONCE(need_future_gp_element(rnp, rnp->completed));
	return need_any_future_gp(rnp);
}

/*
+2 −1
Original line number Diff line number Diff line
@@ -169,7 +169,8 @@ struct rcu_node {
	bool __nonzero = false;						\
									\
	for (__i = 0; __i < ARRAY_SIZE((rnp)->need_future_gp); __i++)	\
		__nonzero = __nonzero || (rnp)->need_future_gp[__i];	\
		__nonzero = __nonzero ||				\
			    READ_ONCE((rnp)->need_future_gp[__i]);	\
	__nonzero;							\
})