Setting CPU affinity for current process on kernel module?

Martin Galvan omgalvan.86 at gmail.com
Wed Sep 11 14:52:06 EDT 2019


Hi,

I have a kernel module which needs to perform CPU core-specific
operations. I know that there's a kernel mode version of
sched_setaffinity, however it's not exported to modules and can only
be accessed through e.g. kallsyms_lookup_name, which is ugly. The
alternative is to spawn a new kthread and bind it to the desired CPU
before starting it, but I was wondering if there's a more
straightforward method of doing this. Thanks!



More information about the Kernelnewbies mailing list