Read the left and right trees once, so that the gating tests are meaningful. This was only a problem at -O0, where the compiler didn't CSE the two reads.
Changes for v2: * Use qatomic_read for left/right while searching (pmm) * Use qatomic_set_mb when inserting a new node, so that we're sure that the new node is consistent. * Abundance of caution: Use qatomic_read/set for manipulating parent. r~ Richard Henderson (4): util/interval-tree: Use qatomic_read for left/right while searching util/interval-tree: Use qatomic_set_mb in rb_link_node util/interval-tree: Introduce pc_parent util/interval-tree: Use qatomic_read/set for rb_parent_color util/interval-tree.c | 79 +++++++++++++++++++++++++++----------------- 1 file changed, 48 insertions(+), 31 deletions(-) -- 2.34.1