On 13/03/2015 09:58, Fam Zheng wrote: >> > >> > This looks good. However, I wonder if dma_aio_cancel should also call >> > cpu_unregister_map_client. In this case, it's much better to just use a >> > lock for the list (though you can still use atomics for the in-use flag). > The other possibility is grab a reference for the cpu_register_map_client > call, > and release it in reschedule_dma. This way the atomics can keep, but we'll > need > a "finished" flag in DMAAIOCB to avoid double completion.
Considering this is a slow path, a lock seems preferrable. It's not that your patch were bad, it's that a pre-existing bug got in your way, and broke the assumptions you made. Paolo