[英]error from sched_setaffinity () call when tid is a kernel thread
I make a call to kernel function sched_setaffinity() to try to lock a kernel thread with a CPU, but it always fails with errno 22 that says "Invalid argument". 我对内核函数sched_setaffinity()进行了调用,以尝试使用CPU锁定内核线程,但是它总是以errno 22失败,提示“ Invalid arguments”。 The machine runs Fedora 15, with kernel version 2.6.38.
该机器运行Fedora 15,内核版本为2.6.38。
This call is successful if a non-kernel tid is passed in. Is this a restriction by the kernel, or is there some tweaking that can make it working? 如果传入了非内核tid,则此调用成功。这是内核的限制,还是有一些调整可以使其正常工作?
Any kernel thread that is bound to a specific CPU with kthread_bind()
cannot have its affinity changed. 使用
kthread_bind()
绑定到特定CPU的任何内核线程都不能更改其亲和力。 It should be possible for other kernel threads, though. 但是,其他内核线程也应该有可能。
在设置地图并将其传递给sched_setaffinity
之前,请确保将地图清零。
CPU_ZERO(&mask);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.