sktpin
sktpin

Reputation: 372

Why does sched_setaffinity work on one system, fails on another?

I have two boards with different ARM CPUs, one 2x core - running Linux kernel 4.1.x, the other 4x core - running 3.10. On those Linux installations I'm always logged in as root. From my program, I set the CPU affinity for the calling process, just like here, via sched_setaffinity(0, ... ), just that I always set it to cpu 1 only. On the Linux 4.1, it works as expected. The Linux 3.1 gives me a negative return value, and on perror(..): "Invalid argument".

Why would that be? A quad core surely has cpu 1?

Upvotes: 4

Views: 3957

Answers (1)

sktpin
sktpin

Reputation: 372

The other CPU cores were not enabled by default.

If they are enabled like described here (but writing 1 instead of 0), it works.

#echo 1 > /sys/devices/system/cpu/cpu1/online

Upvotes: 2

Related Questions