]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit - kernel/sched/core.c
sched,rcu: Make cond_resched() provide RCU quiescent state
authorPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Wed, 30 Nov 2016 14:24:30 +0000 (06:24 -0800)
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Mon, 9 Oct 2017 21:25:17 +0000 (14:25 -0700)
commitf79c3ad6189624c3de0ad5521610c9e22a1c33cf
tree82bfe610ef11d2dbaf120f7ddbbc250ec4f917fb
parent8a5776a5f49812d29fe4b2d0a2d71675c3facf3f
sched,rcu: Make cond_resched() provide RCU quiescent state

There is some confusion as to which of cond_resched() or
cond_resched_rcu_qs() should be added to long in-kernel loops.
This commit therefore eliminates the decision by adding RCU quiescent
states to cond_resched().  This commit also simplifies the code that
used to interact with cond_resched_rcu_qs(), and that now interacts with
cond_resched(), to reduce its overhead.  This reduction is necessary to
allow the heavier-weight cond_resched_rcu_qs() mechanism to be invoked
everywhere that cond_resched() is invoked.

Part of that reduction in overhead converts the jiffies_till_sched_qs
kernel parameter to read-only at runtime, thus eliminating the need for
bounds checking.

Reported-by: Michal Hocko <mhocko@kernel.org>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
[ paulmck: Keep PREEMPT=n cond_resched a no-op, per Peter Zijlstra. ]
kernel/rcu/tree.c
kernel/sched/core.c