Re: [PATCH 3/4] ALSA: timer: Introduce virtual userspace-driven timers

From: Ivan Orlov
Date: Sun Jul 28 2024 - 07:55:08 EST


On 7/28/24 11:29, Christophe JAILLET wrote:

I may be wrong but I think that ida allocates hunks for 1024 bits (128 bytes * 8) at a time. (see [1])

So with this extra sape and the sapce for the xarray, it would waste a few bytes of memory, yes.

With ida, there is also some locking that may be unnecessary (but harmless)


Hoping, I got it right, here are a few numbers:

On a x86_64, with allmodconfig:

Your initial patch:
   text       data        bss        dec        hex    filename
  55020       1783        268      57071       deef    sound/core/timer.o

With ida:
  54763       1631        116      56510       dcbe    sound/core/timer.o
+ 128 bytes of runtime memory allocation

With bitmap:
  54805       1535        132      56472       dc98    sound/core/timer.o


I think that the code would be slightly more elegant with ida, but implementing it with a bitmap does not add that much complexity.


Ah, alright, I agree that the code would be cleaner when using IDA, and such a small memory overhead won't be significant/noticeable. I'm going to use IDA in the V2 instead of bitmap API, thank you so much for pointing me to it (I was wondering if the Kernel has a generic ID allocator and now I finally know it does :) ).

Thank you!

--
Kind regards,
Ivan Orlov