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

David Woodhouse
2018-07-11T14:23:54Z

[-- Attachment #1: Type: text/plain, Size: 1257 bytes --]

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 #2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 5213 bytes --]