Alan Stern wrote:

To sum up, DMA I/O buffers should be allocated separately from regular
data structures, using kmalloc(). Multiple buffers with non-overlapping
lifetimes can share a region like a C union. Multiple output buffers with
overlapping lifetimes can share a region like a C struct. On some
architectures this can be done without penalty, one others there's no
penalty provided that the total size of the buffers is <= 16 bytes. Although output buffers may share a region with other data, they probably shouldn't.

I like simpler rules. Mine would be: "Use usb_buffer_alloc() in preference to kmalloc(), for i/o memory you're re-using."

Trying to write code that's cacheline-aware is error prone.
Better to use memory that's known to be dma-coherent, and
not have to worry about all those corner cases.

- Dave




------------------------------------------------------- This SF.net email is sponsored by: Etnus, makers of TotalView, The best thread debugger on the planet. Designed with thread debugging features you've never dreamed of, try TotalView 6 free at www.etnus.com. _______________________________________________ [EMAIL PROTECTED] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to