[ltt-dev] [PATCH 07/10] call_rcu: remove write-only qlen variable

Mathieu Desnoyers compudj at krystal.dyndns.org
Wed Jun 8 18:46:20 EDT 2011


* Paul E. McKenney (paulmck at linux.vnet.ibm.com) wrote:
> On Wed, Jun 08, 2011 at 06:15:30PM -0400, Mathieu Desnoyers wrote:
> > * Paolo Bonzini (pbonzini at redhat.com) wrote:
> > > The qlen variable is write-only, we can remove it easily.
> > 
> > I defer to Paul for this one: he likes keeping qlen there so the
> > debugger can show the list state, which is useful for debugging. I'll
> > let you two figure out how to come to an agreement. ;)
> 
> Indeed, I have often used gdb to read ->qlen.  ;-)

So maybe adding a comment besides qlen stating the reason why it's there
(e.g. for debugging purposes) might be appropriate ?

Thanks,

Mathieu

> 
> 							Thanx, Paul
> 
> > Mathieu
> > 
> > > 
> > > Signed-off-by: Paolo Bonzini <pbonzini at redhat.com>
> > > ---
> > >  urcu-call-rcu-impl.h |    9 ---------
> > >  1 files changed, 0 insertions(+), 9 deletions(-)
> > > 
> > > diff --git a/urcu-call-rcu-impl.h b/urcu-call-rcu-impl.h
> > > index 7e6acdd..ca597d0 100644
> > > --- a/urcu-call-rcu-impl.h
> > > +++ b/urcu-call-rcu-impl.h
> > > @@ -47,7 +47,6 @@ struct call_rcu_data {
> > >  	struct cds_wfq_queue cbs;
> > >  	unsigned long flags;
> > >  	int futex;
> > > -	unsigned long qlen;
> > >  	pthread_t tid;
> > >  	int cpu_affinity;
> > >  	struct cds_list_head list;
> > > @@ -198,7 +197,6 @@ int set_thread_cpu_affinity(struct call_rcu_data *crdp)
> > >  
> > >  static void *call_rcu_thread(void *arg)
> > >  {
> > > -	unsigned long cbcount;
> > >  	struct cds_wfq_node *cbs;
> > >  	struct cds_wfq_node **cbs_tail;
> > >  	struct call_rcu_data *crdp = (struct call_rcu_data *)arg;
> > > @@ -218,7 +216,6 @@ static void *call_rcu_thread(void *arg)
> > >  			cbs_tail = (struct cds_wfq_node **)
> > >  				uatomic_xchg(&crdp->cbs.tail, &crdp->cbs.head);
> > >  			synchronize_rcu();
> > > -			cbcount = 0;
> > >  			do {
> > >  				while (cbs->next == NULL &&
> > >  				       &cbs->next != cbs_tail)
> > > @@ -230,9 +227,7 @@ static void *call_rcu_thread(void *arg)
> > >  				rhp = (struct rcu_head *)cbs;
> > >  				cbs = cbs->next;
> > >  				rhp->func(rhp);
> > > -				cbcount++;
> > >  			} while (cbs != NULL);
> > > -			uatomic_sub(&crdp->qlen, cbcount);
> > >  		}
> > >  		if (uatomic_read(&crdp->flags) & URCU_CALL_RCU_STOP)
> > >  			break;
> > > @@ -267,7 +262,6 @@ static void call_rcu_data_init(struct call_rcu_data **crdpp,
> > >  	}
> > >  	memset(crdp, '\0', sizeof(*crdp));
> > >  	cds_wfq_init(&crdp->cbs);
> > > -	crdp->qlen = 0;
> > >  	crdp->futex = 0;
> > >  	crdp->flags = flags;
> > >  	cds_list_add(&crdp->list, &call_rcu_data_list);
> > > @@ -519,7 +513,6 @@ void call_rcu(struct rcu_head *head,
> > >  	head->func = func;
> > >  	crdp = get_call_rcu_data();
> > >  	cds_wfq_enqueue(&crdp->cbs, &head->next);
> > > -	uatomic_inc(&crdp->qlen);
> > >  	wake_call_rcu_thread(crdp);
> > >  }
> > >  
> > > @@ -565,8 +558,6 @@ void call_rcu_data_free(struct call_rcu_data *crdp)
> > >  		cbs_endprev = (struct cds_wfq_node **)
> > >  			uatomic_xchg(&default_call_rcu_data, cbs_tail);
> > >  		*cbs_endprev = cbs;
> > > -		uatomic_add(&default_call_rcu_data->qlen,
> > > -			    uatomic_read(&crdp->qlen));
> > >  		cds_list_del(&crdp->list);
> > >  		free(crdp);
> > >  	}
> > > -- 
> > > 1.7.4.4
> > > 
> > > 
> > > 
> > > _______________________________________________
> > > ltt-dev mailing list
> > > ltt-dev at lists.casi.polymtl.ca
> > > http://lists.casi.polymtl.ca/cgi-bin/mailman/listinfo/ltt-dev
> > > 
> > 
> > -- 
> > Mathieu Desnoyers
> > Operating System Efficiency R&D Consultant
> > EfficiOS Inc.
> > http://www.efficios.com
> 

-- 
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com




More information about the lttng-dev mailing list