}
data->nr_pages = nr_pages;
+ atomic_set(&data->lock, -1);
rcu_assign_pointer(counter->data, data);
if (in_nmi() && atomic_read(&data->lock) == cpu)
return;
- while (atomic_cmpxchg(&data->lock, 0, cpu) != 0)
+ while (atomic_cmpxchg(&data->lock, -1, cpu) != -1)
cpu_relax();
handle->locked = 1;
* NMI can happen here, which means we can miss a done_head update.
*/
- cpu = atomic_xchg(&data->lock, 0);
+ cpu = atomic_xchg(&data->lock, -1);
WARN_ON_ONCE(cpu != smp_processor_id());
/*
/*
* Since we had it locked, we can lock it again.
*/
- while (atomic_cmpxchg(&data->lock, 0, cpu) != 0)
+ while (atomic_cmpxchg(&data->lock, -1, cpu) != -1)
cpu_relax();
goto again;