Skip to content

Commit

Permalink
lib: test_objpool: Use kthread_run_on_cpu()
Browse files Browse the repository at this point in the history
Use the proper API instead of open coding it.

Reviewed-by: Matt Wu <[email protected]>
Signed-off-by: Frederic Weisbecker <[email protected]>
  • Loading branch information
Frederic Weisbecker committed Jan 2, 2025
1 parent 294fca6 commit 192faeb
Showing 1 changed file with 5 additions and 14 deletions.
19 changes: 5 additions & 14 deletions lib/test_objpool.c
Original file line number Diff line number Diff line change
Expand Up @@ -371,14 +371,10 @@ static int ot_start_sync(struct ot_test *test)
if (!cpu_online(cpu))
continue;

work = kthread_create_on_node(ot_thread_worker, item,
cpu_to_node(cpu), "ot_worker_%d", cpu);
if (IS_ERR(work)) {
work = kthread_run_on_cpu(ot_thread_worker, item,
cpu, "ot_worker_%d");
if (IS_ERR(work))
pr_err("failed to create thread for cpu %d\n", cpu);
} else {
kthread_bind(work, cpu);
wake_up_process(work);
}
}

/* wait a while to make sure all threads waiting at start line */
Expand Down Expand Up @@ -562,14 +558,9 @@ static int ot_start_async(struct ot_test *test)
if (!cpu_online(cpu))
continue;

work = kthread_create_on_node(ot_thread_worker, item,
cpu_to_node(cpu), "ot_worker_%d", cpu);
if (IS_ERR(work)) {
work = kthread_run_on_cpu(ot_thread_worker, item, cpu, "ot_worker_%d");
if (IS_ERR(work))
pr_err("failed to create thread for cpu %d\n", cpu);
} else {
kthread_bind(work, cpu);
wake_up_process(work);
}
}

/* wait a while to make sure all threads waiting at start line */
Expand Down

0 comments on commit 192faeb

Please sign in to comment.