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

David Woodhouse
2018-07-09T18:51:05Z

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

On Mon, 2018-07-09 at 09:34 -0700, Paul E. McKenney wrote:
> diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
> index 51919985f6cf..33b0a1ec0536 100644
> --- a/kernel/rcu/tree.c
> +++ b/kernel/rcu/tree.c
> @@ -2496,6 +2496,10 @@ void rcu_check_callbacks(int user)
>  {
>   trace_rcu_utilization(TPS("Start scheduler-tick"));
>   raw_cpu_inc(rcu_data.ticks_this_gp);
> + if (smp_load_acquire(this_cpu_ptr(&rcu_dynticks.rcu_urgent_qs)) &&
> +    !is_idle_task(current))
> + set_tsk_need_resched(current);

OK, so this will make KVM (and various other code) see that
need_resched() is true, and they'll call cond_resched() or something
else that might not actually schedule another task, but will at least
end up in rcu_all_qs()...

> + __this_cpu_write(rcu_dynticks.rcu_urgent_qs, false);

... which bails out immediately and does nothing, because that's set to
false?

Am I missing something?

>   rcu_flavor_check_callbacks(user);
>   if (rcu_pending())
>   invoke_rcu_core();
>

[-- Attachment #2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 5213 bytes --]