Skip to content

opal/lifo: add missing opal_atomic_wmb and remove unnecessary opal_atomic_rmb #771

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 4, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions opal/class/opal_lifo.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,20 +187,22 @@ static inline opal_list_item_t *opal_lifo_pop_atomic (opal_lifo_t* lifo)
{
opal_list_item_t *item;
while ((item = (opal_list_item_t *) lifo->opal_lifo_head.data.item) != &lifo->opal_lifo_ghost) {
opal_atomic_rmb();

/* ensure it is safe to pop the head */
if (opal_atomic_swap_32((volatile int32_t *) &item->item_free, 1)) {
continue;
}

opal_atomic_wmb ();

/* try to swap out the head pointer */
if (opal_atomic_cmpset_ptr (&lifo->opal_lifo_head.data.item, item,
(void *) item->opal_list_next)) {
break;
}

/* NTH: don't need another atomic here */
item->item_free = 0;

/* Do some kind of pause to release the bus */
}

Expand Down