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

From: Paul E. McKenney
Date: Thu Jun 18 2020 - 13:57:22 EST


On Thu, Jun 18, 2020 at 07:35:20PM +0200, Uladzislau Rezki wrote:
> > >
> > > 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);
> > >
> > > 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 suspect that he would like to keep the tracing.
> >
> > It might be worth trying the branches, given that they would be constant
> > and indexed by "i". The compiler might well remove the indirection.
> >
> > The compiler guys brag about doing so, which of course might or might
> > not have any correlation to a given compiler actually doing so. :-/
> >
> > Having a vfree_bulk() might well be useful, but I would feel more
> > confidence in that if there were other callers of kfree_bulk().
> >
> Hmm... I think replacing that with vfree_bulk() is a good idea though.

In other words, get rid of kfree_bulk() in favor of vfree_bulk()?

> > But again, either way, future work as far as this series is concerned.
> >
> What do you mean: is concerned?

Apologies for the strange English. How about this?

"This series is OK as is. Any comments above did not prevent me from
taking these patches, but instead discuss possible future work."

> We are planning to implement kfree_rcu() to be integrated directly into
> SLAB: SLAB, SLUB, SLOB. So, there are plenty of future work :)

And I am glad that this is still the goal. ;-)

Thanx, Paul