Interrupts:
Interrupts are signal that are sent across IRQ (Interrupt Request Line) by a hardware or software. Interrupts allow devices like keyboard, serial cards and parallel ports to indicate that it needs CPU attention.
On a Linux machine, the file /proc/interrupts contains information about the interrupts in use and how many times processor has been interrupted.
SMP_AFFINITY:
Symmetric multiprocessing is the processing of programs by multiple processors.
smp_affinity file holds interrupt affinity value for a IRQ number. The smp_affinity file associated with each IRQ number is stored in /proc/irq/IRQ_NUMBER/smp_affinity file. The value in the file is stored in hexadecimal bit-mask representing all CPU cores in the system. smp_affinity works for device that has IO-APIC enabled device drivers.
For example, smp_affinity entry for Ethernet driver is shown below:
root@test007:grep eth0 /proc/interrupts
CPU0 CPU1 CPU2 CPU3 CPU4 CPU5 CPU6 CPU7
67: 0 23834931 0 0 0 0 0 0 IO-APIC-level eth0
IRQ number for eth0 is 67 and corresponding smp_affinity file will be located at:
root@test007: cat /proc/irq/67/smp_affinity
10
The decimal equivalent for hexadecimal value ‘10’ is ‘2’. ie All the interrupt related to Ethernet driver will be serviced by 2nd cpu (CPU1)
============
"10" is the hexadecimal representation for the decimal number 2
and the binary pattern of "0010". Each of the places in the binary pattern
corresponds to a CPU in the server, which means we can use the following
chart to represent the CPU bit patterns:
Binary Hex
CPU 0 0001 1
CPU 1 0010 2
CPU 2 0100 4
CPU 3 1000 8
By combining these bit patterns (basically, just adding the Hex values), we
can address more than one processor at a time. For example, if I wanted
to talk to both CPU0 and CPU2 at the same time, the result is:
Binary Hex
CPU 0 0001 1
+ CPU 2 0100 4
-----------------------
both 0101 5
If I want to address all four of the processors at once, then the result is:
Binary Hex
CPU 0 0001 1
CPU 1 0010 2
CPU 2 0100 4
+ CPU 3 1000 8
-----------------------
both 1111 f
Given that, we now know that if we have a eight processor system, we can
assign any different CPU combinations to an IRQ.
example:
echo "01" > /proc/irq/67/smp_affinity for 1st core
echo "03" > /proc/irq/67/smp_affinity for assign on 1st and 2nd core
echo "05" > /proc/irq/67/smp_affinity for assigning 1st and 3rd core
echo "f0" > /proc/irq/67/smp_affinity for assigning 5th to 8th core
====================
Note : If you are not good in hex to bin conversion, please use this site.
IRQ Balance
Irqbalance is a utility that distributes interrupts over the processor cores in your computer system. which helps to improve performance.
It's goal is to find a balance between power saving and optimal performance.
Irqbalance is especially useful on systems with multi-core processors, as interrupts will typically only be serviced by the first core.
Interrupts are signal that are sent across IRQ (Interrupt Request Line) by a hardware or software. Interrupts allow devices like keyboard, serial cards and parallel ports to indicate that it needs CPU attention.
On a Linux machine, the file /proc/interrupts contains information about the interrupts in use and how many times processor has been interrupted.
SMP_AFFINITY:
Symmetric multiprocessing is the processing of programs by multiple processors.
smp_affinity file holds interrupt affinity value for a IRQ number. The smp_affinity file associated with each IRQ number is stored in /proc/irq/IRQ_NUMBER/smp_affinity file. The value in the file is stored in hexadecimal bit-mask representing all CPU cores in the system. smp_affinity works for device that has IO-APIC enabled device drivers.
For example, smp_affinity entry for Ethernet driver is shown below:
root@test007:grep eth0 /proc/interrupts
CPU0 CPU1 CPU2 CPU3 CPU4 CPU5 CPU6 CPU7
67: 0 23834931 0 0 0 0 0 0 IO-APIC-level eth0
IRQ number for eth0 is 67 and corresponding smp_affinity file will be located at:
root@test007: cat /proc/irq/67/smp_affinity
10
The decimal equivalent for hexadecimal value ‘10’ is ‘2’. ie All the interrupt related to Ethernet driver will be serviced by 2nd cpu (CPU1)
============
"10" is the hexadecimal representation for the decimal number 2
and the binary pattern of "0010". Each of the places in the binary pattern
corresponds to a CPU in the server, which means we can use the following
chart to represent the CPU bit patterns:
Binary Hex
CPU 0 0001 1
CPU 1 0010 2
CPU 2 0100 4
CPU 3 1000 8
By combining these bit patterns (basically, just adding the Hex values), we
can address more than one processor at a time. For example, if I wanted
to talk to both CPU0 and CPU2 at the same time, the result is:
Binary Hex
CPU 0 0001 1
+ CPU 2 0100 4
-----------------------
both 0101 5
If I want to address all four of the processors at once, then the result is:
Binary Hex
CPU 0 0001 1
CPU 1 0010 2
CPU 2 0100 4
+ CPU 3 1000 8
-----------------------
both 1111 f
Given that, we now know that if we have a eight processor system, we can
assign any different CPU combinations to an IRQ.
example:
echo "01" > /proc/irq/67/smp_affinity for 1st core
echo "03" > /proc/irq/67/smp_affinity for assign on 1st and 2nd core
echo "05" > /proc/irq/67/smp_affinity for assigning 1st and 3rd core
echo "f0" > /proc/irq/67/smp_affinity for assigning 5th to 8th core
====================
Note : If you are not good in hex to bin conversion, please use this site.
IRQ Balance
Irqbalance is a utility that distributes interrupts over the processor cores in your computer system. which helps to improve performance.
It's goal is to find a balance between power saving and optimal performance.
Irqbalance is especially useful on systems with multi-core processors, as interrupts will typically only be serviced by the first core.
No comments:
Post a Comment