Re: [PATCH] generic device DMA (dma_pool update)

James Bottomley
2002-12-31T23:39:28Z

david-b@pacbell.net said:
> USB device drivers tend to either allocate and reuse one dma buffer
> (kmalloc/kfree usage pattern) or use dma mapping ... so far.

Please be careful with this in drivers. Coherent memory can be phenomenally
expensive to obtain on some hardware. Sometimes it has to be implemented by
turning off caching and globally flushing the tlb. Thus it really makes
sense most of the time for drivers to allocate all the coherent memory they
need initially and not have it go through the usual memory allocate/free cycle
except under extreme conditions. That's sort really what both pci_pool and
mempool aim for.

James