zwemail2
zwemail2

Reputation: 1

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". The machine runs Fedora 15, with kernel version 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?

Upvotes: 0

Views: 3684

Answers (2)

mods
mods

Reputation: 13

Make sure you zero the map before setting it and passing it to sched_setaffinity.

CPU_ZERO(&mask);

Upvotes: 0

caf
caf

Reputation: 239041

Any kernel thread that is bound to a specific CPU with kthread_bind() cannot have its affinity changed. It should be possible for other kernel threads, though.

Upvotes: 2

Related Questions