]> git.karo-electronics.de Git - karo-tx-linux.git/commit
USB: change the memory limits in usbfs URB submission
authorAlan Stern <stern@rowland.harvard.edu>
Thu, 17 Nov 2011 21:41:25 +0000 (16:41 -0500)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 18 Nov 2011 19:09:07 +0000 (11:09 -0800)
commitadd1aaeabe6b08ed26381a2a06e505b2f09c3ba5
tree42519bb5709cc0943eab7dfa8ca1481ebcdf3815
parent52fb743d3aa7ee27a4f3182816aa02dc3e513d9d
USB: change the memory limits in usbfs URB submission

For a long time people have complained about the limitations imposed
by usbfs.  URBs coming from userspace are not allowed to have transfer
buffers larger than a more-or-less arbitrary maximum.

While it is generally a good idea to avoid large transfer buffers
(because the data has to be bounced to/from a contiguous kernel-space
buffer), it's not the kernel's job to enforce such limits.  Programs
should be allowed to submit URBs as large as they like; if there isn't
sufficient contiguous memory available then the submission will fail
with a simple ENOMEM error.

On the other hand, we would like to prevent programs from submitting a
lot of small URBs and using up all the DMA-able kernel memory.  To
that end, this patch (as1497) replaces the old limits on individual
transfer buffers with a single global limit on the total amount of
memory in use by usbfs.  The global limit is set to 16 MB as a nice
compromise value: not too big, but large enough to hold about 300 ms
of data for high-speed transfers.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/core/devio.c