Skip to content

Commit ce69868

Browse files
committed
Merge pull request open-mpi#468 from hjelmn/v2.x_fifo_lifo_fixes
V2.x fifo lifo fixes
2 parents 15acacb + 2e1767a commit ce69868

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

opal/class/opal_fifo.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,8 @@ static inline opal_list_item_t *opal_fifo_push_atomic (opal_fifo_t *fifo,
189189

190190
item->opal_list_next = &fifo->opal_fifo_ghost;
191191

192+
opal_atomic_wmb ();
193+
192194
/* try to get the tail */
193195
tail_item = opal_atomic_swap_ptr (&fifo->opal_fifo_tail.data.item, item);
194196

opal/class/opal_lifo.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,20 +187,22 @@ static inline opal_list_item_t *opal_lifo_pop_atomic (opal_lifo_t* lifo)
187187
{
188188
opal_list_item_t *item;
189189
while ((item = (opal_list_item_t *) lifo->opal_lifo_head.data.item) != &lifo->opal_lifo_ghost) {
190-
opal_atomic_rmb();
191-
192190
/* ensure it is safe to pop the head */
193191
if (opal_atomic_swap_32((volatile int32_t *) &item->item_free, 1)) {
194192
continue;
195193
}
196194

195+
opal_atomic_wmb ();
196+
197197
/* try to swap out the head pointer */
198198
if (opal_atomic_cmpset_ptr (&lifo->opal_lifo_head.data.item, item,
199199
(void *) item->opal_list_next)) {
200200
break;
201201
}
202+
202203
/* NTH: don't need another atomic here */
203204
item->item_free = 0;
205+
204206
/* Do some kind of pause to release the bus */
205207
}
206208

0 commit comments

Comments
 (0)