Linux – CPU Affinity on ARM processors

armlinux

I am using some RaspberryPI boards for a data acquisition system. They are nice boards, with plenty of community support around them, but they are really slow. I am thinking of gradually replacing them with ODROID multicore boards, with the Samsung Exynos processors.

I have some experience using taskset to set CPU affinity on my servers because I am always running Node.js applications that are by definition single threaded.

Now, is it possible to do this on an ARM board? I do not see why it would not in theory, but I have doubts over how well it is going to work.

Does anyone have experience with this kind of hack? Also, I would appreciate any comments about ARM CPUs and how they differ from x86.

Best Answer

Yes, it's possible.
taskset is an operating system level function: it doesn't matter what CPU architecture you're using (within reason), you're just telling the kernel where it can and can't run things.

The differences between ARM and x86 are largely immaterial here, so I won't get into them in any level of detail (though you should be aware of them and their implications for your particular use case -- this is a research project for you in your spare time).


No, you should not do this.
Do not try to outsmart the scheduler.
The scheduler is smarter than you think it is.
In most cases, the scheduler is smarter than you are.

The scheduler was designed by people who fully understand the operating system's internals. These people have lots of real-world experience optimizing systems, and they've poured that experience (along with no small amount of blood, sweat, tears, and profanity) into your operating system's scheduler algorithm.

As David said, using taskset or other tools to manually force affinity (or any other scheduler settings) may make sense if and only if you know for a fact that your situation is "special" and the scheduler will do the Wrong Thing if left to its own devices.
These are surgical tools designed for very specific, very narrow sets of circumstances.
Using the tools incorrectly will wind up killing people hurting performance.

Related Topic