Re: [PATCH tip/core/rcu 1/4] sched,rcu: Make cond_resched() provide RCU quiescent state

From: Peter Zijlstra
Date: Thu Oct 05 2017 - 06:41:03 EST


On Wed, Oct 04, 2017 at 02:50:22PM -0700, Paul E. McKenney wrote:
> diff --git a/include/linux/sched.h b/include/linux/sched.h
> index 26a7df4e558c..59688ef3ea23 100644
> --- a/include/linux/sched.h
> +++ b/include/linux/sched.h
> @@ -1565,10 +1565,11 @@ static inline int test_tsk_need_resched(struct task_struct *tsk)
> * cond_resched_lock() will drop the spinlock before scheduling,
> * cond_resched_softirq() will enable bhs before scheduling.
> */
> +void rcu_all_qs(void);
> #ifndef CONFIG_PREEMPT
> extern int _cond_resched(void);
> #else
> -static inline int _cond_resched(void) { return 0; }
> +static inline int _cond_resched(void) { rcu_all_qs(); return 0; }
> #endif

Why does it need to change PREEMPT? the whole cond_resched() thing
should be a no-op on PREEMPT.