aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/rcu/update.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/rcu/update.c')
-rw-r--r--kernel/rcu/update.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/kernel/rcu/update.c b/kernel/rcu/update.c
index 5fd1ddbfcc55..403fc4ae539e 100644
--- a/kernel/rcu/update.c
+++ b/kernel/rcu/update.c
@@ -367,6 +367,13 @@ static struct rcu_head *rcu_tasks_cbs_head;
367static struct rcu_head **rcu_tasks_cbs_tail = &rcu_tasks_cbs_head; 367static struct rcu_head **rcu_tasks_cbs_tail = &rcu_tasks_cbs_head;
368static DEFINE_RAW_SPINLOCK(rcu_tasks_cbs_lock); 368static DEFINE_RAW_SPINLOCK(rcu_tasks_cbs_lock);
369 369
370/* Track exiting tasks in order to allow them to be waited for. */
371DEFINE_SRCU(tasks_rcu_exit_srcu);
372
373/* Control stall timeouts. Disable with <= 0, otherwise jiffies till stall. */
374static int rcu_task_stall_timeout __read_mostly = HZ * 60 * 3;
375module_param(rcu_task_stall_timeout, int, 0644);
376
370/* Post an RCU-tasks callback. */ 377/* Post an RCU-tasks callback. */
371void call_rcu_tasks(struct rcu_head *rhp, void (*func)(struct rcu_head *rhp)) 378void call_rcu_tasks(struct rcu_head *rhp, void (*func)(struct rcu_head *rhp))
372{ 379{
@@ -518,6 +525,15 @@ static int __noreturn rcu_tasks_kthread(void *arg)
518 rcu_read_unlock(); 525 rcu_read_unlock();
519 526
520 /* 527 /*
528 * Wait for tasks that are in the process of exiting.
529 * This does only part of the job, ensuring that all
530 * tasks that were previously exiting reach the point
531 * where they have disabled preemption, allowing the
532 * later synchronize_sched() to finish the job.
533 */
534 synchronize_srcu(&tasks_rcu_exit_srcu);
535
536 /*
521 * Each pass through the following loop scans the list 537 * Each pass through the following loop scans the list
522 * of holdout tasks, removing any that are no longer 538 * of holdout tasks, removing any that are no longer
523 * holdouts. When the list is empty, we are done. 539 * holdouts. When the list is empty, we are done.
@@ -546,6 +562,11 @@ static int __noreturn rcu_tasks_kthread(void *arg)
546 * ->rcu_tasks_holdout accesses to be within the grace 562 * ->rcu_tasks_holdout accesses to be within the grace
547 * period, avoiding the need for memory barriers for 563 * period, avoiding the need for memory barriers for
548 * ->rcu_tasks_holdout accesses. 564 * ->rcu_tasks_holdout accesses.
565 *
566 * In addition, this synchronize_sched() waits for exiting
567 * tasks to complete their final preempt_disable() region
568 * of execution, cleaning up after the synchronize_srcu()
569 * above.
549 */ 570 */
550 synchronize_sched(); 571 synchronize_sched();
551 572