Conditionally wait for an rcu grace period
void cond_synchronize_rcu(unsigned long oldstate);
oldstate
return value from earlier call to get_state_synchronize_rcu
If a full RCU grace period has elapsed since the earlier call to get_state_synchronize_rcu, just return. Otherwise, invoke synchronize_rcu to wait for a full grace period.
Yes, this function does not take counter wrap into account. But counter wrap is harmless. If the counter wraps, we have waited for more than 2 billion grace periods (and way more on a 64-bit system!), so waiting for one additional grace period should be just fine.