[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8fb02f6.b8dd.196c54b3349.Coremail.00107082@163.com>
Date: Tue, 13 May 2025 00:19:22 +0800 (CST)
From: "David Wang" <00107082@....com>
To: "Alan Stern" <stern@...land.harvard.edu>
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
At 2025-05-12 23:34:41, "Alan Stern" <stern@...land.harvard.edu> wrote:
>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
Thanks for the quick feedback~
I will work on it and update later~
David
Powered by blists - more mailing lists