Re: patch to shift memory allocations to usb_alloc_urb()

Alan Stern <[email protected]>
Newsgroups gmane.linux.usb.devel
Message-ID <[email protected]>
On Thu, 5 Jul 2007, Matthew Dharm wrote:

> On Mon, Jul 02, 2007 at 09:15:03AM +0200, Oliver Neukum wrote:
> > Am Montag, 2. Juli 2007 schrieb Alan Stern:
> > > If you look at usbmon logs of real usb-storage data transfers you'll
> > > see that multi-page sg elements occur quite frequently.  (Of course,
> > > that doesn't prevent us from transferring only one page per URB.)
> > 
> > OK, but the storage driver allocates the URBs on the fly. If we change
> > that to preallocation we need to have enough URBs for the worst case.
> 
> Of course, in the storage case we control the worst-case.  By adjusting the
> parameter which controls how long a sg list the SCSI core will send us, we
> can effectively limit the worst-case number of URBs needed.

But we don't control max_sectors, so we can't effectively limit the 
total transfer size.

While I agree that it would be nice to preallocate enough URBs and
memory that only one IRQ would be needed, I don't see anything wrong
with preallocating a reasonably large amount and re-using it as needed.  
So we might get 3 or 4 times as many IRQs for particularly large
transfers; that doesn't seem too bad.  It's a justifiable time-space
tradeoff.

A reasonably large amount might be enough for a 32 KB transfer at full
speed or a 120 KB transfer (the default maximum) at high speed.  Or we 
might want to take into account the actual storage requirements of the 
HCDs; UHCI is much the worst in that regard.

Alan Stern


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.