Related to the following articles. A note on how to limit the CPU cores on which each kthread runs.
[Linux] [kernel module] Create kthread in kernel module --Qiita
You can use void kthread_bind (struct task_struct * k, unsigned int cpu)
.
kthread_bind()/linux2.6 - LinuxKernelHackJapan
If you specify more than one, there is also kthread_bind_mask (2)
, so you should use this (unverified).
void kthread_bind_mask(struct task_struct *k, const struct cpumask *mask)
Example of use
struct task_struct *k0;
struct task_struct *k1;
k0 = kthread_run(kthread_func0, NULL, "task0");
k1 = kthread_run(kthread_func1, NULL, "task1");
kthread_bind(k0, 0);
kthread_bind(k1, 1);
Specify the task_struct and cpu core number obtained at the time of kthread_run ()
.
See / proc / cpuinfo
etc. for the status of cpu in the current environment.
[Linux] [kernel module] Create kthread in kernel module --Qiita
linux/include/linux/kthread.h - Elixir - Free Electrons kthread_bind()/linux2.6 - LinuxKernelHackJapan
Recommended Posts