CPU pinning

Peter Teoh htmldeveloper at gmail.com
Mon Sep 26 12:38:54 EDT 2011


well, use the term "cpu affinity" when u google and u will find more
info (correct) from others - my answer is not complete - there are
situation where u can do tuning - read further here:

http://honglus.blogspot.com/2011/03/tune-interrupt-and-process-cpu-affinity.html
http://www.ibm.com/developerworks/linux/library/l-affinity/index.html

at the lowest level, the IRQ is handled at the the CPU inside
arch/x86/kernel/irq_32.c.

Inside this file, u can always identify your own SMP core by a
specific smp ID, and if it matches, then continue processing the IRQ,
otherwise, just ignore the processing, and let the other processor
does the work - not sure if I am right?

On Mon, Sep 26, 2011 at 7:28 PM, Kernel Piddu <kernelpiddu at gmail.com> wrote:
> Thanks so much for the detailed info. It's very comprehensive. Thanks for taking the time.
>
> On Sep 26, 2011, at 6:51 AM, Peter Teoh <htmldeveloper at gmail.com> wrote:
>
>> On Fri, Sep 16, 2011 at 5:08 AM, Kernel Piddu <kernelpiddu at gmail.com> wrote:
>>>
>>>> I have a multi processor system/machine and I would like dedicate a CPU entirely to listen on to a port.
>>>> I would greatly appreciate if you could tell me how this can be done.
>>>>
>>>> Thanks!
>>>
>>
>> doing this in the kernel, is perhaps not really recommended, and linux
>> kernel is become UNIX-non-compliant if such features were ever
>> provided.
>> but userspace, is definitely possible, but is always a suggestive
>> tuning....the kernel can always override your request:
>> http://www.cyberciti.biz/tips/setting-processor-affinity-certain-task-or-process.html
>> but this is per-process, if u want per-port IRQ handling attach to the
>> core, then this is going to affect the algorithm kernel used for
>> SoftIRQ handling:
>>
>> doing a "cat /proc/softirqs" on my system:
>>
>>                 CPU0       CPU1       CPU2       CPU3
>>       HI:          0          0          0          0
>>    TIMER:     563854     591025          0          0
>>   NET_TX:          7          6          0          0
>>   NET_RX:      17486      19250          0          0
>>    BLOCK:      28888       3784          0          0
>> BLOCK_IOPOLL:          0          0          0          0
>>  TASKLET:     399230     391008          0          0
>>    SCHED:     116858     119604          0          0
>>  HRTIMER:        978        610          0          0
>>      RCU:     158513     192567          0          0
>>
>> i can see that the IRQ processing is skewed, but then unless i have an
>> overall picture of what every core is doing.....not advisable to touch
>> that.
>>
>> anyway looking at the "processes":
>>
>> root         3     2  0 16:59 ?        00:00:00 [ksoftirqd/0]
>> root         7     2  0 16:59 ?        00:00:00 [ksoftirqd/1]
>>
>> only two tasklet thread are spawned to handle the these softirq at
>> each core.   i suspect some error in the interpreting the number of
>> cores here, as there is only two core. (/proc/cpuinfo).
>>
>> good reading on these internals:
>>
>> http://lwn.net/Articles/308117/
>> http://www.wil.cx/matthew/lca2003/paper.pdf
>>
>> --
>> Regards,
>> Peter Teoh
>



-- 
Regards,
Peter Teoh



More information about the Kernelnewbies mailing list