On Fri, Sep 20, 2013 at 03:06:43AM +0200, Markus Rechberger wrote: > On Fri, Sep 20, 2013 at 1:57 AM, Markus Rechberger > <mrechberger@xxxxxxxxx> wrote: > > > > This patch adds memory mapping support to USBFS for isochronous and bulk data transfers, it allows to pre-allocate usb transfer buffers. > > I guess some things can be made a little bit nicer here so any feedback is welcome. > > The CPU usage decreases 1-2% on my 1.3ghz U7300 notebook when transferring 20mbyte/sec, it should be more interesting to see those statistics on embedded systems where copying data is more expensive. > > > > Usage from userspace: > > allocation: > > rv = ioctl(priv->usbfd, USBDEVFS_ALLOC_MEMORY, &mem); > > if (rv == 0) > > buffer = mmap(NULL, size, PROT_READ|PROT_WRITE, MAP_SHARED, priv->usbfd, mem.offset); > > use the mapped buffer with urb->buffer. > > release: > > rv = munmap(buffer, size); > > memset(&mem, 0x0, sizeof(struct usbdevfs_memory)); > > mem.buffer = buffer; > > rv = ioctl(priv->usbfd, USBDEVFS_FREE_MEMORY, &mem); > > > > non freed memory buffers are collected and will be released when closing the node. > > > > I tested this patch with Bulk and Isochronous, with and without memory mapping (applications which don't use mmap will just fall back to the legacy mechanism). > > > > http://sundtek.de/support/devio_mmap_v0.1.diff The first version of this patch didn't make it to the mailing list due to it probably being in html format. Take a look at the Documentation/email_clients.txt file for ways to work around this. Also, we need a signed-off-by: line in order to be able to apply this. > > diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c > > index 737e3c1..d588e2e 100644 > > --- a/drivers/usb/core/devio.c > > +++ b/drivers/usb/core/devio.c > > @@ -30,6 +30,7 @@ > > * 04.01.2000 0.2 Turned into its own filesystem > > * 30.09.2005 0.3 Fix user-triggerable oops in async URB delivery > > * (CAN-2005-3055) > > + * 19.09.2013 Added memory mapping support for data packets No need to do this as the git changelog will contain the proper information. I should rip this out in the file one of these days to not confuse people... thanks, greg k-h -- 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