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

Commit 0d805a70 authored by Joel Fernandes (Google)'s avatar Joel Fernandes (Google) Committed by Paul E. McKenney
Browse files

rcu: Add comment documenting how rcu_seq_snap works



rcu_seq_snap may be tricky to decipher. Lets document how it works with
an example to make it easier.

Signed-off-by: default avatarJoel Fernandes (Google) <joel@joelfernandes.org>
Signed-off-by: default avatarPaul E. McKenney <paulmck@linux.vnet.ibm.com>
[ paulmck: Shrink comment as suggested by Peter Zijlstra. ]
parent b06ae25a
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -91,7 +91,17 @@ static inline void rcu_seq_end(unsigned long *sp)
	WRITE_ONCE(*sp, rcu_seq_endval(sp));
}

/* Take a snapshot of the update side's sequence number. */
/*
 * rcu_seq_snap - Take a snapshot of the update side's sequence number.
 *
 * This function returns the earliest value of the grace-period sequence number
 * that will indicate that a full grace period has elapsed since the current
 * time.  Once the grace-period sequence number has reached this value, it will
 * be safe to invoke all callbacks that have been registered prior to the
 * current time. This value is the current grace-period number plus two to the
 * power of the number of low-order bits reserved for state, then rounded up to
 * the next value in which the state bits are all zero.
 */
static inline unsigned long rcu_seq_snap(unsigned long *sp)
{
	unsigned long s;