Re: [PATCH 22/32] rcu: Restart tick if we enqueue a callback in a nohz/cpuset CPU

Frederic Weisbecker
2011-08-17T02:18:35Z

On Tue, Aug 16, 2011 at 01:20:05PM -0700, Paul E. McKenney wrote:
> > @@ -1546,6 +1547,13 @@ __call_rcu(struct rcu_head *head, void (*func)(struct rcu_head *rcu),
> > rdp->nxttail[RCU_NEXT_TAIL] = &head->next;
> > rdp->qlen++;
> >
> > + /* Restart the timer if needed to handle the callbacks */
> > + if (tick_nohz_adaptive_mode()) {
> > + /* Make updates on nxtlist visible to self IPI */
> > + barrier();
> > + smp_cpuset_update_nohz(smp_processor_id());
> > + }
> > +
>
> But this must be happening in a system call or interrupt handler, right?
> If so, won't we get a chance to check things on exit from the system call
> or interrupt? Or are you hooking only into syscall entry?

Sure in theory when we call call_rcu() we are in the kernel and thus not
very far from a syscall/exception/irq exit into userspace or a scheduling
out.

We could rely on that assumption and I bet it won't ever be a problem
in practice. I just wanted to ensure we don't spend too much time
before handling that callback.

> > /* If interrupts were disabled, don't dive into RCU core. */
> > if (irqs_disabled_flags(flags)) {
> > local_irq_restore(flags);
> > --
> > 1.7.5.4
> >