Re: [PATCH 11/18] seqcount: Introduce raw_write_seqcount_barrier()

Ingo Molnar
2015-06-18T09:40:24Z

* Peter Zijlstra <peterz@infradead.org> wrote:

> > > I doubt there's a single OS kernel (that supports SMP configurations) that
> > > does not rely on a whole host of 'undefined' behaviour.
> >
> > An alternative approach would be a compiler switch (or similar) that changed
> > the default atomic access from SC to relaxed. Then shared variables could be
> > marked atomic, and normal C code could be used to access them, but without the
> > compiler emitting memory barriers all over the place (yes, even on x86).
>
> See, I don;'t think that is a realistic approach. Who is going to audit our ~16
> million lines of code to mark all shared variables? Or all the other existing
> code bases that rely on this behaviour?

Sidenote: we are well beyond 19 million lines meanwhile.

But generating speculative writes unless the compiler can prove it's not shared
memory are crazy. Who on earth argues they are sane?

In what retarded use-case do unasked for speculative writes even make any sense
beyond as a sadistic tool to make parallel, threaded code even more fragile??

Thanks,

Ingo