On Sun, 1 Jul 2007, Oliver Neukum wrote: > Am Sonntag, 1. Juli 2007 schrieb Matthew Dharm: > > On Sun, Jul 01, 2007 at 11:00:43AM +0200, Oliver Neukum wrote: > > > My goals are: > > > > > > - guarantee the storage driver a fallback path without memory allocation > > > > What about avoiding allocation of memory during a usb-storage transfer > > completely? > > IIRC Alan computed the worst case memory requirements and for > permanently allocated memory it was bad.
It's bad only if you insist on allocating and submitting all the URBs for the transfer at once, as the s-g library does. If instead we reused a single URB over and over and transferred no more than one page at a time, the memory requirements would not be so bad. > > Does anyone know if the SCSI core actually follows the sg_tablesize > > parameter in the struct scsi_host_template ? Right now, it's set to > > SG_ALL, which means "unlimited number of sg elements", but any other > > non-zero value is supposed to be the maximum number of segments that the > > SCSI core sends to usb-storage. > > It seems to me that this is the key parameter determining the throughput > of the storage driver. No. Just as important as the number of sg elements is the total transfer size. Since each sg element refers to a page or more of data, the maximum number of elements is restricted by the maximum allowed transfer size (which is currently 512 KB or 128 pages on i386). The default max transfer size set by usb-storage is 120 KB. Larger values would lead to larger throughput but the benefit would be slight. However none of this matters if you don't insist on allocating a separate URB for each sg element. 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/ _______________________________________________ linux-usb-devel@lists.sourceforge.net To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel