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

From: David Woodhouse
Date: Mon Jul 09 2018 - 14:51:05 EST




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: smime.p7s
Description: S/MIME cryptographic signature