简体   繁体   English

当tid是内核线程时,来自sched_setaffinity()调用的错误

[英]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.

相关问题 如何使用 sched_setaffinity 清除线程关联,这意味着我想将控制权交还给 kernel? - How can I clear thread affinity with sched_setaffinity meaning I want to give control back to the kernel? SCHED_DEADLINE的sched_setaffinity() - sched_setaffinity() for SCHED_DEADLINE 如何从 C 在 Linux 中使用 sched_getaffinity 和 sched_setaffinity? - How to use sched_getaffinity and sched_setaffinity in Linux from C? linux中的sched_setaffinity cpu affinity - sched_setaffinity cpu affinity in linux 隐式声明函数'sched_setaffinity' - implicit declaration of function ‘sched_setaffinity’ taskset和sched_setaffinity之间的交互 - Interaction between taskset and sched_setaffinity sched_setaffinity()如何工作? - How does sched_setaffinity() work? 使用sched_setaffinity固定到核心后,如何取消固定线程? - How can I unpin a thread after pinning to a core using sched_setaffinity? 在被调用的core_pattern过程中调用sched_setaffinity失败 - sched_setaffinity fails when called in core_pattern called procedure 调度程序是否可以通过`sched_setaffinity`自动将亲和性已设置为非常繁忙的cpu的线程迁移到空闲cpu? - Could scheduler automatically migrate the thread whose affinity has been set to a very busy cpu through `sched_setaffinity` to a free cpu?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM