From: Ming Lei > On Mon, Jan 13, 2014 at 9:26 PM, David Laight <David.Laight@xxxxxxxxxx> wrote: > >> > >> I believe all processing use the urb->num_sgs field to limit the number > >> of entries. Common interfaces like dma_map_sg() and for_each_sg() limit > >> their processing to "nents" entries, and the USB code use the value of > >> urb->num_sgs for this parameter. > > > > Which mostly means that the sg_xxx functions are doing a whole load > > of unnecessary instructions and memory accesses... > > > > This probably has a lot to do with the significant difference in the > > cpu use for the usb3 and 'normal' ethernet interfaces. > > > > While each bit doesn't seem significant, they soon add up. > > If you plan to remove the 'nents' parameter, I am wondering if it is > a good idea, because sg_nents() should be more heavy. Not mention > sometimes the callers just want to map/unmap part of entries. I was thinking of using a simple address/length array without all the extra fields and flags 'overpunched' in the low address bits. I'm not even sure the current use is strictly correct. The field names of the scatterlist have a page address and offset but the buffers passed to xhci (at least by usbnet) can span multiple pages - they are physically contiguous. IIRC some traces of requests for USB disks show a separate SG entry for each 4k page - even for both virtually and physically adjacent pages. David -- 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