void idle_inject_stop()

in idle_inject.c [228:261]


void idle_inject_stop(struct idle_inject_device *ii_dev)
{
	struct idle_inject_thread *iit;
	unsigned int cpu;

	pr_debug("Stopping idle injection on CPUs '%*pbl'\n",
		 cpumask_pr_args(to_cpumask(ii_dev->cpumask)));

	hrtimer_cancel(&ii_dev->timer);

	/*
	 * Stopping idle injection requires all of the idle injection kthreads
	 * associated with the given cpumask to be parked and stay that way, so
	 * prevent CPUs from going online at this point.  Any CPUs going online
	 * after the loop below will be covered by clearing the should_run flag
	 * that will cause the smpboot main loop to schedule them out.
	 */
	cpu_hotplug_disable();

	/*
	 * Iterate over all (online + offline) CPUs here in case one of them
	 * goes offline with the should_run flag set so as to prevent its idle
	 * injection kthread from running when the CPU goes online again after
	 * the ii_dev has been freed.
	 */
	for_each_cpu(cpu, to_cpumask(ii_dev->cpumask)) {
		iit = per_cpu_ptr(&idle_inject_thread, cpu);
		iit->should_run = 0;

		wait_task_inactive(iit->tsk, 0);
	}

	cpu_hotplug_enable();
}