opal/lifo: fix a ABA problem in opal_lifo_pop_atomic
that was introduced in open-mpi/ompi@11bb8b09a0 Fixes open-mpi/ompi#4784 Signed-off-by: Gilles Gouaillardet <gilles@rist.or.jp>
Этот коммит содержится в:
родитель
efd715ed85
Коммит
9121eb4ff9
@ -14,8 +14,8 @@
|
|||||||
* Copyright (c) 2010 IBM Corporation. All rights reserved.
|
* Copyright (c) 2010 IBM Corporation. All rights reserved.
|
||||||
* Copyright (c) 2014-2017 Los Alamos National Security, LLC. All rights
|
* Copyright (c) 2014-2017 Los Alamos National Security, LLC. All rights
|
||||||
* reseved.
|
* reseved.
|
||||||
* Copyright (c) 2016 Research Organization for Information Science
|
* Copyright (c) 2016-2018 Research Organization for Information Science
|
||||||
* and Technology (RIST). All rights reserved.
|
* and Technology (RIST). All rights reserved.
|
||||||
* $COPYRIGHT$
|
* $COPYRIGHT$
|
||||||
*
|
*
|
||||||
* Additional copyrights may follow
|
* Additional copyrights may follow
|
||||||
@ -240,9 +240,7 @@ static inline opal_list_item_t *opal_lifo_pop_atomic (opal_lifo_t* lifo)
|
|||||||
{
|
{
|
||||||
opal_list_item_t *item, *head, *ghost = &lifo->opal_lifo_ghost;
|
opal_list_item_t *item, *head, *ghost = &lifo->opal_lifo_ghost;
|
||||||
|
|
||||||
item = (opal_list_item_t *) lifo->opal_lifo_head.data.item;
|
while ((item=(opal_list_item_t *)lifo->opal_lifo_head.data.item) != ghost) {
|
||||||
|
|
||||||
while (item != ghost) {
|
|
||||||
/* ensure it is safe to pop the head */
|
/* ensure it is safe to pop the head */
|
||||||
if (opal_atomic_swap_32((volatile int32_t *) &item->item_free, 1)) {
|
if (opal_atomic_swap_32((volatile int32_t *) &item->item_free, 1)) {
|
||||||
continue;
|
continue;
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user