Re: [PATCH 11/24] rcu/tree: Maintain separate array for vmalloc ptrs

Uladzislau Rezki
2020-05-04T14:25:56Z

> > @@ -3072,21 +3105,34 @@ static inline bool queue_kfree_rcu_work(struct kfree_rcu_cpu *krcp)
> > krwp = &(krcp->krw_arr[i]);
> >
> > /*
> > - * Try to detach bhead or head and attach it over any
> > + * Try to detach bkvhead or head and attach it over any
> > * available corresponding free channel. It can be that
> > * a previous RCU batch is in progress, it means that
> > * immediately to queue another one is not possible so
> > * return false to tell caller to retry.
> > */
> > - if ((krcp->bhead && !krwp->bhead_free) ||
> > + if ((krcp->bkvhead[0] && !krwp->bkvhead_free[0]) ||
> > + (krcp->bkvhead[1] && !krwp->bkvhead_free[1]) ||
> > (krcp->head && !krwp->head_free)) {
> > - /* Channel 1. */
> > - if (!krwp->bhead_free) {
> > - krwp->bhead_free = krcp->bhead;
> > - krcp->bhead = NULL;
> > + /*
> > + * Channel 1 corresponds to SLAB ptrs.
> > + */
> > + if (!krwp->bkvhead_free[0]) {
> > + krwp->bkvhead_free[0] = krcp->bkvhead[0];
> > + krcp->bkvhead[0] = NULL;
> > }
> >
> > - /* Channel 2. */
> > + /*
> > + * Channel 2 corresponds to vmalloc ptrs.
> > + */
> > + if (!krwp->bkvhead_free[1]) {
> > + krwp->bkvhead_free[1] = krcp->bkvhead[1];
> > + krcp->bkvhead[1] = NULL;
> > + }
>
> Why not a "for" loop here? Duplicate code is most certainly not what
> we want, as it can cause all sorts of trouble down the road.
>
Agree. Can be done. Thanks :)

--
Vlad Rezki