tech-kern archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
2*(void *) atomic swap?
Do we have a magic function that can perform two atomic_swap_ptr()
atomically?
In kern/subr_kmem.c::kmem_guard_free(), the code used to be
rotor = atomic_inc_uint_nv(&kg->kg_rotor) % kg->kg_depth;
va = (vaddr_t)atomic_swap_ptr(&kg->kg_fifo[rotor], (void *)va);
if (va != 0) {
vmem_free(kg->kg_vmem, va, size);
}
The va was inserted into the FIFO atomically, and that was fine. Now
we also need to register the size of the va into that FIFO, which means
we have to perform another atomic_swap_ptr(), but there's obviously a
window in the meantime.
I don't want to use a global lock; it may slow down the system..
Home |
Main Index |
Thread Index |
Old Index