On 2/12/24 07:50, Aleksandr Mezin wrote:
On Mon, Feb 12, 2024 at 5:13 PM Guenter Roeck <linux@xxxxxxxxxxxx> wrote:
On 2/12/24 06:12, Aleksandr Mezin wrote:
Instead of pre-allocating a buffer and synchronizing the access to it,
simply allocate memory when needed.
Fewer synchronization primitives, fewer lines of code.
Trading that for runtime overhead and an additional failure point ?
Because it's a USB device, hid_hw_output_report() calls
usbhid_output_report() -> usb_interrupt_msg() -> usb_bulk_msg() ->
usb_alloc_urb() -> kmalloc(). So there's already the same failure
point, and the overhead is already there, no?
Honestly, I didn't think too much about performance - because I expect
such devices to send and receive not more than 10 reports per second.
I don't insist on this change, I just want to understand when to
prefer simplicity vs potential performance.
We'll have to agree to disagree that we have a different understanding
of "simplicity".
Guenter