* node before publication.
*/
- rcu_read_lock();
for (;;) {
- struct rcu_lfq_node *tail = rcu_dereference(q->tail);
- struct rcu_lfq_node *next;
+ struct rcu_lfq_node *tail, *next;
+ rcu_read_lock();
+ tail = rcu_dereference(q->tail);
/*
* Typically expect tail->next to be NULL.
*/
* further and retry.
*/
uatomic_cmpxchg(&q->tail, tail, next);
+ rcu_read_unlock();
continue;
}
}
struct rcu_lfq_node *
rcu_lfq_dequeue(struct rcu_lfq_queue *q, void (*release)(struct urcu_ref *))
{
- rcu_read_lock();
for (;;) {
- struct rcu_lfq_node *head = rcu_dereference(q->head);
- struct rcu_lfq_node *next = rcu_dereference(head->next);
+ struct rcu_lfq_node *head, *next;
+ rcu_read_lock();
+ head = rcu_dereference(q->head);
+ next = rcu_dereference(head->next);
if (next) {
if (uatomic_cmpxchg(&q->head, head, next) == head) {
rcu_read_unlock();
return next;
} else {
/* Concurrently pushed, retry */
+ rcu_read_unlock();
continue;
}
} else {