lkml.org 
[lkml]   [2020]   [Aug]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v1 3/5] seqlock: seqcount_t: Implement all read APIs as statement expressions
On Fri, Aug 28, 2020 at 10:30:22AM +0200, peterz@infradead.org wrote:
> On Fri, Aug 28, 2020 at 03:07:08AM +0200, Ahmed S. Darwish wrote:
> > #define __read_seqcount_begin(s) \
> > +({ \
> > + unsigned seq; \
> > + \
> > + do { \
> > + seq = __seqcount_sequence(s); \
> > + if (likely(! (seq & 1))) \
> > + break; \
> > + cpu_relax(); \
> > + } while (true); \
> > + \
> > + kcsan_atomic_next(KCSAN_SEQLOCK_REGION_MAX); \
> > + seq; \
> > +})
>
> Since we're there anyway, does it make sense to (re)write this like:
>
> while ((seq = __seqcount_sequence(s)) & 1)
> cpu_relax();
>
> ?
>

Yeah, much better of course; will do.

Thanks,

--
Ahmed S. Darwish
Linutronix GmbH

\
 
 \ /
  Last update: 2020-08-28 10:37    [W:0.234 / U:13.384 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site