aboutsummaryrefslogtreecommitdiff
path: root/kernel/rcu
diff options
context:
space:
mode:
authorLorDClockaN <davor@losinj.com>2019-03-27 18:32:24 +0100
committerLorDClockaN <davor@losinj.com>2019-03-27 18:32:24 +0100
commita8e12a51a8c22de9f1281b06f3cd85de5d0ab564 (patch)
tree45230cd53d8092c346bd00810e3046fcea43666a /kernel/rcu
parent92857b007d911bfff7e65465694d28bf8fe96fc7 (diff)
parentb96e2451dc7dc8df5b5b330af0e96a8ae0e5a421 (diff)
Merge branch 'p9x' of https://github.com/DirtyUnicorns/android_kernel_google_bluecross.git into HEADHEADp9.0
Diffstat (limited to 'kernel/rcu')
-rw-r--r--kernel/rcu/tree.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index 084c41cf6295..7fd74ef51a2b 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -1718,15 +1718,23 @@ static int rcu_future_gp_cleanup(struct rcu_state *rsp, struct rcu_node *rnp)
}
/*
- * Awaken the grace-period kthread for the specified flavor of RCU.
- * Don't do a self-awaken, and don't bother awakening when there is
- * nothing for the grace-period kthread to do (as in several CPUs
- * raced to awaken, and we lost), and finally don't try to awaken
- * a kthread that has not yet been created.
+ * Awaken the grace-period kthread. Don't do a self-awaken (unless in
+ * an interrupt or softirq handler), and don't bother awakening when there
+ * is nothing for the grace-period kthread to do (as in several CPUs raced
+ * to awaken, and we lost), and finally don't try to awaken a kthread that
+ * has not yet been created. If all those checks are passed, track some
+ * debug information and awaken.
+ *
+ * So why do the self-wakeup when in an interrupt or softirq handler
+ * in the grace-period kthread's context? Because the kthread might have
+ * been interrupted just as it was going to sleep, and just after the final
+ * pre-sleep check of the awaken condition. In this case, a wakeup really
+ * is required, and is therefore supplied.
*/
static void rcu_gp_kthread_wake(struct rcu_state *rsp)
{
- if (current == rsp->gp_kthread ||
+ if ((current == rsp->gp_kthread &&
+ !in_interrupt() && !in_serving_softirq()) ||
!READ_ONCE(rsp->gp_flags) ||
!rsp->gp_kthread)
return;