Irqbalance: Difference between revisions
Created page with "irqbalance is a utility that helps balance interrupts across all available CPUs on a system. The tool does the balancing by setting the appropriate CPU affinities for each IRQ..." |
|||
| Line 1: | Line 1: | ||
irqbalance is a utility that helps balance interrupts across all available CPUs on a system. The tool does the balancing by setting the appropriate CPU affinities for each IRQ source. | irqbalance is a utility that helps balance interrupts across all available CPUs on a system. The tool does the balancing by setting the appropriate CPU affinities for each IRQ source. | ||
=== Interrupts overloading a single CPU === | ===Interrupts overloading a single CPU=== | ||
Without irqbalance, you might see a single ksoftirqd process running with a high CPU utilization. On a busy system, you might see this stuck at 100% CPU. To confirm what's happening, run: | Without irqbalance, you might see a single ksoftirqd process running with a high CPU utilization. On a busy system, you might see this stuck at 100% CPU. To confirm what's happening, run: | ||
{{Highlight | {{Highlight | ||
| code = $ watch -d -n 1 "cat /proc/interrupts" | | code = $ watch -d -n 1 "cat /proc/interrupts" | ||
## To ignore inactive interrupts | |||
$ watch -d -n 1 "cat /proc/interrupts {{!}} grep -vE '^\s*[0-9]+:[ 0]* [A-Za-Z]+'" | |||
| lang = terminal | | lang = terminal | ||
}} | }} | ||
Using <code>watch</code> and the <code>--diff</code> option, you can see how fast the number of interrupts are increasing for each IRQ source. If you see large numbers within a single column, you should try running irqbalance to help balance out the IRQ sources across multiple CPU cores. | Using <code>watch</code> and the <code>--diff</code> option, you can see how fast the number of interrupts are increasing for each IRQ source. If you see large numbers within a single column, you should try running irqbalance to help balance out the IRQ sources across multiple CPU cores. | ||
=== Under the hood === | ===Under the hood=== | ||
What irqbalance does is it reads <code>/proc/interrupts</code> and determines the IRQ sources. It then tries to balance out the IRQs across all CPU cores by setting the appropriate CPU affinity flags under <code>/proc/irq/<irq>/smp_affinity</code>. | What irqbalance does is it reads <code>/proc/interrupts</code> and determines the IRQ sources. It then tries to balance out the IRQs across all CPU cores by setting the appropriate CPU affinity flags under <code>/proc/irq/<irq>/smp_affinity</code>. | ||
If you need to manually balance out IRQs, you can turn off irqbalance and tweak the smp affinities yourself. | If you need to manually balance out IRQs, you can turn off irqbalance and tweak the smp affinities yourself. | ||
Revision as of 01:39, 16 November 2021
irqbalance is a utility that helps balance interrupts across all available CPUs on a system. The tool does the balancing by setting the appropriate CPU affinities for each IRQ source.
Interrupts overloading a single CPU
Without irqbalance, you might see a single ksoftirqd process running with a high CPU utilization. On a busy system, you might see this stuck at 100% CPU. To confirm what's happening, run:
$ watch -d -n 1 "cat /proc/interrupts"
## To ignore inactive interrupts
$ watch -d -n 1 "cat /proc/interrupts | grep -vE '^\s*[0-9]+:[ 0]* [A-Za-Z]+'"
Using watch and the --diff option, you can see how fast the number of interrupts are increasing for each IRQ source. If you see large numbers within a single column, you should try running irqbalance to help balance out the IRQ sources across multiple CPU cores.
Under the hood
What irqbalance does is it reads /proc/interrupts and determines the IRQ sources. It then tries to balance out the IRQs across all CPU cores by setting the appropriate CPU affinity flags under /proc/irq/<irq>/smp_affinity.
If you need to manually balance out IRQs, you can turn off irqbalance and tweak the smp affinities yourself.