Re: [PATCH v2 09/16] rcu/tree: Maintain separate array for vmalloc ptrs

From: Uladzislau Rezki
Date: Thu Jun 18 2020 - 13:30:58 EST


> >
> > Not an emergency, but did you look into replacing this "if" statement
> > with an array of pointers to functions implementing the legs of the
> > "if" statement? If nothing else, this would greatly reduced indentation.
>
> I don't think that replacing direct function calls with indirect function
> calls is a great suggestion with the current state of play around branch
> prediction.
>
> I'd suggest:
>
> rcu_lock_acquire(&rcu_callback_map);
> trace_rcu_invoke_kfree_bulk_callback(rcu_state.name,
> bkvhead[i]->nr_records, bkvhead[i]->records);
> if (i == 0) {
> kfree_bulk(bkvhead[i]->nr_records,
> bkvhead[i]->records);
> } else {
> for (j = 0; j < bkvhead[i]->nr_records; j++) {
> vfree(bkvhead[i]->records[j]);
> }
> }
> rcu_lock_release(&rcu_callback_map);
>
There are two different trace functions, one for "bulk" tracing
messages, and another one is per one call of kfree(), though we use
to indicate vfree() call.

Probably we can rename it to: trace_rcu_invoke_kvfree_callback();

What do you think?

>
> But I'd also suggest a vfree_bulk be added. There are a few things
> which would be better done in bulk as part of the vfree process
> (we batch them up already, but i'm sure we could do better).
>
I was thinking to implement of vfree_bulk() API, but i guess it can
be done as future work.

Does that sound good?

--
Vlad Rezki