Re: [PATCH] rcutorture: add random preemption

From: Peter Zijlstra
Date: Mon Jun 21 2010 - 12:50:27 EST


On Mon, 2010-06-21 at 09:43 -0700, Paul E. McKenney wrote:
> > +#ifdef CONFIG_PREEMPT
> > + if (!preempt_count() && !(rcu_random(rrsp) % (nrealreaders * 20000)))
> > + preempt_schedule();
> > +#endif
>
> This one scared me for a bit -- then I realized that preempt_schedule()
> won't actually schedule if preemption is in any way disabled. So the
> above really is OK, because Classic RCU and RCU-bh disable preemption.
>
> So, should we have a comment to this effect, or is my hypersensitivity to
> RCU semantics unique to me?

Well it seems to do a !preempt_count() test too, so I wouldn't worry too
much about it, still using preempt_schedule() doesn't seem right, why
not use cond_resched()?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/