tech-kern archive

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

Re: [PATCH] xhci: Reduce ring memory usage



On 30/03/2020 08:20, sc.dying%gmail.com@localhost wrote:
Hello.

  Most devices use a few endpoints but current xhci code allocates all of
31 endpoints in the slot when a device is connected.
  This patch defers ring memory allocation to when usbd_open_pipe opens
the endpoint, and it allocates one ring for an endpoint.

  For example, a ordinary network device uses 4 endpoints.
It requires 192296 bytes in old code on amd64, it requires
25096 bytes in new code.

Old:
sizeof xhci_slot 1832
ring dma buf 4096 (per endpoint) x 31
xr_cookie 2048 (per endpoint) x 31

1832 + (4096 + 2048) x 32 = 192296

New:
sizeof xhci_slot 296
sizeof xhci_ring 56 (per endpoint) x 4
ring dma buf 4096 (per endpoint) x 4
xr_cookie 2048 (per endpoint) x 4

296 + (56 + 4096 + 2048) x 4 = 25096

  I've replaced xhci_endpoint in xhci_slot with xhci_ring *[], as there are
no other structures other than xhci_ring in xhci_endpoint.



Committed.

Thanks,
Nick


Home | Main Index | Thread Index | Old Index