Re: [PATCH 3/5] seqlock: introduce seqprop_lock/unlock

Oleg Nesterov
2023-09-15T18:49:33Z

On 09/15, Alexey Gladkov wrote:
>
> On Wed, Sep 13, 2023 at 05:50:00PM +0200, Oleg Nesterov wrote:
> > + \
> > +static __always_inline void \
> > +__seqprop_##lockname##_lock(seqcount_##lockname##_t *s, \
> > + locktype *lock) \
> > +{ \
> > + __SEQ_LOCK(WARN_ON_ONCE(s->lock != lock)); \
> > + lockbase##_lock(lock); \
> > +} \
> > + \
> > +static __always_inline void \
> > +__seqprop_##lockname##_unlock(seqcount_##lockname##_t *s, \
> > + locktype *lock) \
> > +{ \
> > + lockbase##_unlock(lock); \
> > }
>
> Why are you creating a new method with an unused argument s ?

To make it consistent/symmetrical with _lock() which does
__SEQ_LOCK(WARN_ON_ONCE(s->lock != lock)). _unlock() could do the
same check as well, but somehow I decided it would be too much.

And with other "methods". Say, __seqprop_##lockname##_preemptible(s)
doesn't use 's' too.

Otherwise they both do not need the 1st seqcount_##lockname##_t *s
argument.

Oleg.