[CentOS] processor affinity

Thu Feb 18 11:17:04 UTC 2010
Simon Billis <simon at houxou.com>

John Doe sent a missive on 2010-02-18:

> From: Simon Billis <simon at houxou.com>
>> To: CentOS mailing list <centos at centos.org>
>> Sent: Thu, February 18, 2010 11:25:41 AM
>> Subject: Re: [CentOS] processor affinity
>> 
>> Adam Grossman sent a missive on 2010-02-17:
>> 
>>> On Wed, 2010-02-17 at 13:26 -0500, Adam Grossman wrote:
>>>> On Wed, 2010-02-17 at 18:17 +0000, Simon Billis wrote:
>>>>> Adam Grossman sent a missive on 2010-02-17:
>>>>> 
>>>>>> Hello,
>>>>>> 
>>>>>> i am running CentOS 5.4.  i have a requirement where i need to have
>>>>>> 1 application have a single processor all to its self, and the rest
>>>>>> of the system run on the other processors.  "taskman" lets me bind
>>>>>> the process to a processor(s), but it does not make it exclusive.
>>>>>> Is this possible to do? i have even tried mucking around with the
>>>>>> rc.sysinit, but to no avail.
>>>>>> 
>>>>>> thank you very much,
>>>>> Have you considered running through the pids of the all tasks
>>>>> and then using taskset to change their affinities. You could
>>>>> also change all the init scripts to invoke the process using
>>>>> something like "taskset -p [mask] [pid]" and limit the mask to
>>>>> only the first few CPU's that you want them to have access to.
>>>>> 
>>>> 
>>>> that's probably a good idea.  have it be the last service that runs
>>>> which moves everything to the processors i want.  i am going to give
>>>> that an try.
>>> 
>>> i was asked to do this for increased performance.  but does centos
>>> have any SMP load balancing which would probably work better then
>>> manually doing load balancing?
>>> 
>> Linux does have cpu load balancing to maximise performance, but
>> performance of an application/process relies on many things. You may
>> have to tune the system for that particular application and also
>> reduce the number of other processes running to maximise the
>> performance. Application tuning may also be required for maximum
> performance gains.
> 
> What about renicing processes...?
> 
> JD

I personally would only renice my processes - most system processes need to
run at a higher priority than user tasks so things don’t break. They also
only utilise a very small proportion of the system so "should" be negligible
in most instances. In my experience understanding what your application is
doing provides the insight into tuning the system for maximum performance.