Re: [PATCH 4/9] usb-core: Free bulk streams on interface release

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

 



Hi,

On 10/04/2013 08:43 PM, Alan Stern wrote:
On Fri, 4 Oct 2013, Hans de Goede wrote:

+	struct usb_host_endpoint *ep, *eps[USB_MAXENDPOINTS];

That's a big array to put on the stack: 30 entries each containing 8
bytes (on a 64-bit arch).

I was wondering about this myself when I wrote this. What do you suggest
as an alternative, kmalloc an array with intf->cur_altsetting->desc.bNumEndpoints
pointers ?

Or simply do 30 pointers every time.  240 bytes isn't all that much for
kmalloc.

Right, the allocating intf->cur_altsetting->desc.bNumEndpoints versus 30
pointers is just an optimization. I was wondering more if it would be
ok here to do a kmalloc(..., GPF_KERNEL), or if this code path is
ever called under interrupt, or some such ?

Also do we allow C-99 style variable length arrays in the kernel ?
Then we could just put what ever we need on the stack (which almost always
will be way less then 240 bytes).

Regards,

Hans
--
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