Print | Rate this content

Red Hat Linux Operating Systems - How Do You Configure smp_affinity, to Assign Specific CPUs to Handle Interrupts from a NIC?

Question

What are the steps to configure smp_affinity , so you can assign specific CPUs to handle interrupts from a NIC in an SMP system?

Answer

In order to configure the smp_affinity parameter, complete the following steps:

  1. Stop and disable irqbalance .

    # service irqbalance stop
    # chkconfig irqbalance off

  2. Disable Message Signal Interrupts (MSI). For RHEL4, this will have to be disabled at the driver level. For RHEL5, you can disable it at the driver level, or at the kernel level. Setting pci-nomsi in grub.conf is supported for disabling at the kernel level in RHEL5.

    To disable it at a driver level, see the driver-specific documentation. For an example, to disable it for the bnx2 driver, use this syntax in /etc/modprobe.conf :

    options bnx2 disable_msi=1

  3. Find the IRQ of the device in question. For this example, we want to set the smp_affinity parameter for eth3 .


    # egrep "CPU|eth3"
    CPU0 CPU1 CPU2 CPU3 CPU4 PU5 PU6 CPU7
    177: 3 8 7 6 2 4 2 5 IO-APIC-level eth3

    From the preceding output, the first column shows an IRQ of 177 for eth3 .

  4. Set the smp_affinity setting in hex numbers for the CPUs that you want to handle the interrupts for this device. Here is a chart for eight CPUs and their hex values.


    CPU BIN HEX
    0 0000 0001 1
    1 0000 0010 2
    2 0000 0100 4
    3 0000 1000 8
    4 0001 0000 10
    5 0010 0000 20
    6 0100 0000 40
    7 1000 0000 80

    If we want only CPUs 3 and 5 to handle the interrupts from eth3 , we would add hex 8 + hex 20 and get hex 28.

  5. Put the value 28 hex into smp_affinity for eth3 , IRQ 177 .

    # /bin/echo "28" > /proc/irq/177/smp_affinity

    Put this echo command in /etc/rc.local , or some other startup file.

Provide feedback

Please rate the information on this page to help us improve our content. Thank you!