D.1.2.2 Read-Side Primitives

The read-side srcu_read_lock() and srcu_read_unlock() primitives are used as shown:



 1 idx = srcu_read_lock(&ss);
 2 /* read-side critical section. */
 3 srcu_read_unlock(&ss, idx);


The ss variable is the struct srcu_struct whose initialization was described in Section [*], and the idx variable is an integer that in effect tells srcu_read_unlock() the grace period during which the corresponding srcu_read_lock() started.

This carrying of an index is a departure from the RCU API, which, when required, stores the equivalent information in the task structure. However, since a given task could potentially occupy an arbitrarily large number of nested SRCU read-side critical sections, SRCU cannot reasonably store this index in the task structure.



Paul E. McKenney 2011-12-16