[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7fd35044-3719-44c1-b4cf-89551e27da26@rowland.harvard.edu>
Date: Mon, 12 May 2025 11:34:41 -0400
From: Alan Stern <stern@...land.harvard.edu>
To: David Wang <00107082@....com>
Cc: mathias.nyman@...el.com, gregkh@...uxfoundation.org,
linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org,
surenb@...gle.com, kent.overstreet@...ux.dev
Subject: Re: [RFC] USB: core/xhci: add a buffer in urb for host controller
private data
On Mon, May 12, 2025 at 11:07:24PM +0800, David Wang wrote:
> ---
> I was checking memory allocation behaviors (via memory profiling[1]),
> when I notice a high frequent memory allocation in xhci_urb_enqueue, about
> 250/s when using a USB webcam. If those alloced buffer could be kept and
> reused, lots of memory allocations could be avoid over time.
>
> This patch is just a POC, about 0/s memory allocation in xhci with this
> patch, when I use my USB devices, webcam/keyboard/mouse.
>
> A dynamic cached memory would be better: URB keep host controller's
> private data, if larger size buffer needed for private data, old buffer
> released and a larger buffer alloced.
This sounds like a better approach; you should try it. Allocations and
dellocations from a private memory pool can be really quick. And it
wouldn't waste space on buffers for URBs that don't need them (for
example, URBs used with other host controller drivers).
Alan Stern
Powered by blists - more mailing lists