Messages in this thread | | | Date | Tue, 26 Jun 2018 21:27:28 +0200 | From | Peter Zijlstra <> | Subject | Re: [PATCH tip/core/rcu 16/27] rcu: Add comment documenting how rcu_seq_snap works |
| |
On Tue, Jun 26, 2018 at 11:10:25AM -0700, Paul E. McKenney wrote: > > Is the below not much simpler: > > > > > static inline unsigned long rcu_seq_snap(unsigned long *sp) > > > { > > > unsigned long s; > > > > s = smp_load_aquire(sp); > > > > /* Add one GP */ > > s += 1 << RCU_SEQ_CTR_SHIFT; > > > > /* Complete any pending state by rounding up */ > > s = __ALIGN_MASK(s, RCU_SEQ_STATE_MASK); > > > > return s; > > } > > Seems equivalent to me, but with more lines. To say nothing of more > levels of lookup of macro definitions. ;-)
But it does explain the various parts in the equation, or at least gives a fair clue as to how the thing composes. And I find the alignment thing far easier to read that an open coded variant, but whatever.
| |