]> git.baikalelectronics.ru Git - kernel.git/commit
rcu: Only do rcu_read_unlock_special() wakeups if expedited
authorPaul E. McKenney <paulmck@linux.ibm.com>
Mon, 1 Apr 2019 21:12:50 +0000 (14:12 -0700)
committerPaul E. McKenney <paulmck@linux.ibm.com>
Sat, 25 May 2019 21:50:48 +0000 (14:50 -0700)
commit01dbd94efb416580ebe0d164af998acdb6199efe
tree86ed797ae9362153f3e61289db3d324c17e3b9b9
parent194f632e4d3aa11c4f25c7b61f3c1f17a1705da7
rcu: Only do rcu_read_unlock_special() wakeups if expedited

Currently, rcu_read_unlock_special() will do wakeups whenever it is safe
to do so.  However, wakeups are expensive, and they are only really
needed when the just-ended RCU read-side critical section is blocking
an expedited grace period (in which case speed is of the essence)
or on a nohz_full CPU (where it might be a good long time before an
interrupt arrives).  This commit therefore checks for these conditions,
and does the expensive wakeups only if doing so would be useful.

Note it can be rather expensive to determine whether or not the current
task (as opposed to the current CPU) is blocking the current expedited
grace period.  Doing so requires traversing the ->blkd_tasks list, which
can be quite long.  This commit therefore cheats:  If the current task
is on a given ->blkd_tasks list, and some task on that list is blocking
the current expedited grace period, the code assumes that the current
task is blocking that expedited grace period.

Reported-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Paul E. McKenney <paulmck@linux.ibm.com>
kernel/rcu/tree_plugin.h