示例#1
0
/*
 * This kthread invokes RCU callbacks whose grace periods have
 * elapsed.  It is awakened as needed, and takes the place of the
 * RCU_SOFTIRQ that was used previously for this purpose.
 * This is a kthread, but it is never stopped, at least not until
 * the system goes down.
 */
static int rcu_kthread(void *arg)
{
	unsigned long work;
	unsigned long morework;
	unsigned long flags;

	for (;;) {
		wait_event_interruptible(rcu_kthread_wq,
					 have_rcu_kthread_work != 0);
		morework = rcu_boost();
		local_irq_save(flags);
		work = have_rcu_kthread_work;
		have_rcu_kthread_work = morework;
		local_irq_restore(flags);
		if (work) {
			rcu_process_callbacks(&rcu_sched_ctrlblk);
			rcu_process_callbacks(&rcu_bh_ctrlblk);
			rcu_preempt_process_callbacks();
		}
		schedule_timeout_interruptible(1); /* Leave CPU for others. */
	}

	return 0;  /* Not reached, but needed to shut gcc up. */
}
static void rcu_process_callbacks(struct softirq_action *unused)
{
	__rcu_process_callbacks(&rcu_sched_ctrlblk);
	__rcu_process_callbacks(&rcu_bh_ctrlblk);
	rcu_preempt_process_callbacks();
}