On Tue, Mar 12, 2019 at 05:34:32PM +0100, Lorenzo Bianconi wrote: > > Alloc sg table at the end of urb structure. This will increase > > cache usage. > > > > I am curious, have you observed any performance improvement doing so? It's hard to measure that. Stressing net transfer with about 175 Mbit/s by netperf (what is max I can get) only took about 15% of CPU for me and net performance fluctuate so CPU pref stats vary too. > > - if (dev->usb.sg_en) { > > - urb->sg = devm_kcalloc(dev->dev, MT_SG_MAX_SIZE, > > - sizeof(urb->sg), GFP_KERNEL); FTR: Here is bug it should be sizeof(*urb->sg). > > - if (!urb->sg) > > - return -ENOMEM; > > - } > > + usb_init_urb(e->urb); > > + > > + if (dev->usb.sg_en) > > + e->urb->sg = (struct scatterlist *)((u8 *)e->urb + sizeof(struct urb)); > > You can avoid u8 cast doing: > (struct scatterlist *)(e->urb + 1) Cool trick! Stanislaw