Proposal for new memory_order_consume definition

From: Paul E. McKenney
Date: Mon Jan 11 2016 - 18:11:44 EST


Hello!

As requested at the October 2015 C++ Standards Committee Meeting, I have
created a single proposal for memory_order_consume in C++:

http://www2.rdrop.com/users/paulmck/submission/consume.2016.01.11b.pdf

This contains an informal description of the proposal, rough-draft
wording changes, and a number of litmus tests demonstrating how the
proposal works.

The required changes to compilers appears to be extremely small,
however, I would like to get more compiler writers' thoughts on the
pointer_cmp_eq_dep(), pointer_cmp_ne_dep(), pointer_cmp_gt_dep(),
pointer_cmp_ge_dep(), pointer_cmp_lt_dep(), and pointer_cmp_le_dep()
intrinsics that do pointer comparisons without breaking dependencies on
their first argument. Figures 25 and 26 on page 16 demonstrate their use.
These intrinsics were suggested at the October meeting, but it would be
good to get wider feedback on them.

Note that last I checked, the Linux kernel actually does not depend
on pointer comparisons not breaking dependency chains, because all
comparisons are against NULL or a list-head structure, in which case
the pointer is not going to be dereferenced after an equals comparison.
But I do believe that some past versions of the Linux kernel have depended
on this.

Thoughts?

Thanx, Paul

PS. For more background information, please see:

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/p0098r0.pdf