Commit b04e317b authored by Frederic Weisbecker's avatar Frederic Weisbecker
Browse files

treewide: Introduce kthread_run_worker[_on_cpu]()



kthread_create() creates a kthread without running it yet. kthread_run()
creates a kthread and runs it.

On the other hand, kthread_create_worker() creates a kthread worker and
runs it.

This difference in behaviours is confusing. Also there is no way to
create a kthread worker and affine it using kthread_bind_mask() or
kthread_affine_preferred() before starting it.

Consolidate the behaviours and introduce kthread_run_worker[_on_cpu]()
that behaves just like kthread_run(). kthread_create_worker[_on_cpu]()
will now only create a kthread worker without starting it.

Signed-off-by: default avatarFrederic Weisbecker <frederic@kernel.org>
Signed-off-by: default avatarDan Carpenter <dan.carpenter@linaro.org>
parent 41f70d8e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -681,7 +681,7 @@ struct kvm_pit *kvm_create_pit(struct kvm *kvm, u32 flags)
	pid_nr = pid_vnr(pid);
	put_pid(pid);

	pit->worker = kthread_create_worker(0, "kvm-pit/%d", pid_nr);
	pit->worker = kthread_run_worker(0, "kvm-pit/%d", pid_nr);
	if (IS_ERR(pit->worker))
		goto fail_kthread;

+1 −1
Original line number Diff line number Diff line
@@ -517,7 +517,7 @@ struct crypto_engine *crypto_engine_alloc_init_and_set(struct device *dev,
	crypto_init_queue(&engine->queue, qlen);
	spin_lock_init(&engine->queue_lock);

	engine->kworker = kthread_create_worker(0, "%s", engine->name);
	engine->kworker = kthread_run_worker(0, "%s", engine->name);
	if (IS_ERR(engine->kworker)) {
		dev_err(dev, "failed to create crypto request pump task\n");
		return NULL;
+1 −1
Original line number Diff line number Diff line
@@ -225,7 +225,7 @@ static void __init cppc_freq_invariance_init(void)
	if (fie_disabled)
		return;

	kworker_fie = kthread_create_worker(0, "cppc_fie");
	kworker_fie = kthread_run_worker(0, "cppc_fie");
	if (IS_ERR(kworker_fie)) {
		pr_warn("%s: failed to create kworker_fie: %ld\n", __func__,
			PTR_ERR(kworker_fie));
+1 −1
Original line number Diff line number Diff line
@@ -277,7 +277,7 @@ int drm_vblank_worker_init(struct drm_vblank_crtc *vblank)

	INIT_LIST_HEAD(&vblank->pending_work);
	init_waitqueue_head(&vblank->work_wait_queue);
	worker = kthread_create_worker(0, "card%d-crtc%d",
	worker = kthread_run_worker(0, "card%d-crtc%d",
				       vblank->dev->primary->index,
				       vblank->pipe);
	if (IS_ERR(worker))
+1 −1
Original line number Diff line number Diff line
@@ -369,7 +369,7 @@ static int live_parallel_switch(void *arg)
		if (!data[n].ce[0])
			continue;

		worker = kthread_create_worker(0, "igt/parallel:%s",
		worker = kthread_run_worker(0, "igt/parallel:%s",
					       data[n].ce[0]->engine->name);
		if (IS_ERR(worker)) {
			err = PTR_ERR(worker);
Loading