Skip to content
Snippets Groups Projects
Commit 282d8998 authored by Paul E. McKenney's avatar Paul E. McKenney
Browse files

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 <quic_neeraju@quicinc.com>
Reported-by: default avatarSong Liu <song@kernel.org>
Tested-by: default avatarkernel test robot <oliver.sang@intel.com>
Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
parent c2445d38
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment