Re: Infrastructure for zerocopy I/O

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 16 Nov 2015, Christoph Hellwig wrote:

> On Mon, Nov 16, 2015 at 08:03:12PM +0100, Steinar H. Gunderson wrote:
> > The original use case: DVB capture on embedded devices.
> > 
> > My use case: USB3 uncompressed HD video capture (from multiple cards).
> > 
> > Both of these hit (beyond the speed boost from zerocopy) the problem that
> > as time goes by, memory gets more fragmented and usbfs fails allocation.
> > Allocating memory up-front solves that.
> 
> As said I think you should just use get_user_pages() on user memory,
> and bounce buffer if it doesn't fit the DMA mask.
> 
> Thіs also allows the user to use hugetlbs if they need large contiguous
> allocations for performance reasons.

In other words, you're suggesting we do this:

	Check that userspace requested zerocopy (otherwise the user 
	program might try to access other data stored in the same cache 
	lines as the buffer while the I/O is in progres);

	Call get_user_pages (or get_user_pages_fast? -- it's not clear 
	which should be used) for this buffer;

	Use the array of pages returned by that routine to populate
	a scatter-gather list (sg_alloc_table_from_pages);

	Pass that list to dma_map_sg.

Is that right?

Does dma_map_sg check the page addresses against the DMA mask and
automatically create a bounce buffer, or do we have to do that
manually?  Documentation/DMA-API-HOWTO.txt doesn't discuss this.

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux