Re: [RFC] Make need_resched() return true when rcu_urgent_qs requested

From: David Woodhouse
Date: Wed Jul 11 2018 - 10:23:54 EST




On Mon, 2018-07-09 at 15:08 -0700, Paul E. McKenney wrote:
> index f9c0ca2ccf0c..3350ece366ab 100644
> --- a/kernel/rcu/tree.c
> +++ b/kernel/rcu/tree.c
> @@ -2839,6 +2839,15 @@ void rcu_check_callbacks(int user)
> ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂrcu_bh_qs();
> ÂÂÂÂÂÂÂÂ}
> ÂÂÂÂÂÂÂÂrcu_preempt_check_callbacks();
> +ÂÂÂÂÂÂÂ/* The load-acquire pairs with the store-release setting to true. */
> +ÂÂÂÂÂÂÂif (smp_load_acquire(this_cpu_ptr(&rcu_dynticks.rcu_urgent_qs))) {
> +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ/* Idle and userspace execution already are quiescent states. */
> +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂif (rcu_is_cpu_rrupt_from_idle() && !user) {

if (idle && !user) seems tautological and... illogical.

If I make it 'if (!rcu_is_cpu_rrput_from_idle() && !user)' it seems to
work better. Ripping out my debugging printks now to check that's still
true...


(Also, isn't userspace execution only a quiescent state if NO_HZ_FULL?)

> +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂset_tsk_need_resched(current);
> +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂset_preempt_need_resched();
> +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ}
> +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ__this_cpu_write(rcu_dynticks.rcu_urgent_qs, false);
> +ÂÂÂÂÂÂÂ}

Attachment: smime.p7s
Description: S/MIME cryptographic signature