Sorry for the spam, I accidentally mapped ctrl+Enter to send without
confirmation and can't teach my fingers not to press it instead of ctrl+delete..
> That's definitely a good addition, kmalloc_nolock was not that good already so
> I tried some way have a preallocation, though I realise it isn't really
> flexible.
>
> Since you're using spinlocks, isn't that going to sleep on PREEMPT_RT?
>
> Isn't this similar to what you'd do with a kmem_cache. That was my original
> idea although that uses spinlocks too.
>
> I quickly tried an implementation like yours using
> mempool_create_slab_pool(prealloc_count) and mempool_alloc_preallocated() and
> it still explodes with my monitors, but perhaps now that tracepoints no longer
> disable preemption it could play well with some monitors.
>
> The selftests with tlob seem to work just the same with this kmem_cache (up to
> the unrelated RCU stall). To be fair since you only allocate from the uprobe
> handler, you'd probably be just fine with kmalloc_nolock, but let's continue
> with the preallocation logic.
>
>
> The API is starting to get complex (well, not that it wasn't already).
> We have essentially 3 ways to allocate:
> * fully automatic with kmalloc_nolock
> * semi-automatic with pool preallocation
> * manual with direct storage preallocation
>
> We can have a macro DA_MON_ALLOCATION_STRATEGY = {DA_ALLOC_AUTO,
> DA_ALLOC_POOL, DA_ALLOC_MANUAL} where DA_MON_POOL also requires
> DA_MON_POOL_SIZE to be define (force that with an #error).
Anyway, this way you probably wouldn't need to define a different init function
and let everything handled more transparently.
Also you don't need to call da_create_or_get() explicitly,
da_handle_start_event() should do it for you.
The only manual step required is da_create_storage() when you explicitly cannot
lock when calling da_handle_start_event() (that would be DA_ALLOC_MANUAL, you
don't need that).
Hope I didn't create too much confusion.
Thanks,
Gabriele