]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
rcu: Don't set nesting depth negative in rcu_preempt_deferred_qs()
authorLai Jiangshan <laijs@linux.alibaba.com>
Sat, 15 Feb 2020 22:37:26 +0000 (14:37 -0800)
committerPaul E. McKenney <paulmck@kernel.org>
Mon, 27 Apr 2020 18:03:50 +0000 (11:03 -0700)
Now that RCU flavors have been consolidated, an RCU-preempt
rcu_read_unlock() in an interrupt or softirq handler cannot possibly
end the RCU read-side critical section.  Consider the old vulnerability
involving rcu_preempt_deferred_qs() being invoked within such a handler
that interrupted an extended RCU read-side critical section, in which
a wakeup might be invoked with a scheduler lock held.  Because
rcu_read_unlock_special() no longer does wakeups in such situations,
it is no longer necessary for rcu_preempt_deferred_qs() to set the
nesting level negative.

This commit therefore removes this recursion-protection code from
rcu_preempt_deferred_qs().

[ paulmck: Fix typo in commit log per Steve Rostedt. ]
Signed-off-by: Lai Jiangshan <laijs@linux.alibaba.com>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
kernel/rcu/tree_plugin.h

index ccad77639d800d6a4103baec5dfb7b11ddde53c6..263c766b9dc1a95a22ad61bef401073b0bc57e75 100644 (file)
@@ -569,16 +569,11 @@ static bool rcu_preempt_need_deferred_qs(struct task_struct *t)
 static void rcu_preempt_deferred_qs(struct task_struct *t)
 {
        unsigned long flags;
-       bool couldrecurse = rcu_preempt_depth() >= 0;
 
        if (!rcu_preempt_need_deferred_qs(t))
                return;
-       if (couldrecurse)
-               rcu_preempt_depth_set(rcu_preempt_depth() - RCU_NEST_BIAS);
        local_irq_save(flags);
        rcu_preempt_deferred_qs_irqrestore(t, flags);
-       if (couldrecurse)
-               rcu_preempt_depth_set(rcu_preempt_depth() + RCU_NEST_BIAS);
 }
 
 /*