]> Git Repo - linux.git/commit
srcu: Prevent expedited GPs and blocking readers from consuming CPU
authorPaul E. McKenney <[email protected]>
Tue, 8 Mar 2022 23:45:33 +0000 (15:45 -0800)
committerPaul E. McKenney <[email protected]>
Tue, 3 May 2022 17:20:57 +0000 (10:20 -0700)
commit282d8998e9979c2186af7f7d22366f2fc3149838
treea89b3241fcd01074c023062015e24de1440f5066
parentc2445d38785086422e56dcbe049b73a53b2ba81f
srcu: Prevent expedited GPs and blocking readers from consuming CPU

If an SRCU reader blocks while a synchronize_srcu_expedited() waits for
that same reader, then that grace period will spawn an endless series of
workqueue handlers, consuming a full CPU.  This quickly gets pointless
because consuming more CPU isn't going to make that reader get done
faster, especially if it is blocked waiting for an external event.

This commit therefore spawns at most one pair of back-to-back workqueue
handlers per expedited grace period phase, instead inserting increasing
delays as that grace period phase grows older, but capped at 10 jiffies.
In any case, if there have been at least 100 back-to-back workqueue
handlers within a single jiffy, regardless of grace period or grace-period
phase, then a one-jiffy delay is inserted.

[ paulmck:  Apply feedback from kernel test robot. ]

Cc: Neeraj Upadhyay <[email protected]>
Reported-by: Song Liu <[email protected]>
Tested-by: kernel test robot <[email protected]>
Signed-off-by: Paul E. McKenney <[email protected]>
include/linux/srcutree.h
kernel/rcu/srcutree.c
This page took 0.057172 seconds and 4 git commands to generate.