Skip to content

Commit 6265aaa

Browse files
committed
Merge pull request #771 from hjelmn/lifo_fix
opal/lifo: add missing opal_atomic_wmb and remove unnecessary opal_atomic_rmb
2 parents 45a8e8d + 6003a4d commit 6265aaa

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

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)