Este conteúdo não está disponível no idioma selecionado.
Chapter 24. Reviewing a system by using the tuna interface
The tuna tool reduces complexity of performing tuning tasks. You can use tuna to adjust scheduler tunables parameters, tune thread priority, IRQ handlers, and isolate CPU cores and sockets. By using tuna, you can perform the following operations:
- List the CPUs on a system.
- List the interrupt requests (IRQs), currently running on a system.
- Change policy and priority information about threads.
- Display the current policies and priorities of a system.
24.1. Installing the tuna tool Copiar o linkLink copiado para a área de transferência!
The tuna tool is designed to be used on a running system. The application-specific measurement tools can start analyzing system performance immediately after making the changes.
Procedure
Install the
tunatool:dnf install tuna
# dnf install tunaCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
Display the available tuna
CLIoptions:tuna -h
# tuna -hCopy to Clipboard Copied! Toggle word wrap Toggle overflow For more information, see the
tuna(8)man page on your system.
24.2. Viewing the system status by using the tuna tool Copiar o linkLink copiado para a área de transferência!
You can use the tuna command-line interface (CLI) tool to view the system status.
Prerequisites
-
The
tunatool is installed. For details, see Installing the tuna tool.
Procedure
View the current policies and priorities:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Alternatively, view a specific thread corresponding to a PID or matching a command name:
tuna show_threads -t pid_or_cmd_list
# tuna show_threads -t pid_or_cmd_listCopy to Clipboard Copied! Toggle word wrap Toggle overflow The pid_or_cmd_list argument is a list of comma-separated PIDs or command-name patterns.
Depending on the scenario, perform one of the following actions:
- To tune CPUs by using the tuna CLI, complete the steps in Tuning CPUs by using the tuna tool.
- To tune the IRQs by using the tuna tool, complete the steps in Tuning IRQs by using the tuna tool.
Save the changed configuration:
tuna save filename
# tuna save filenameCopy to Clipboard Copied! Toggle word wrap Toggle overflow This command saves only currently running kernel threads. Processes that are not running are not saved.
24.3. Tuning CPUs by using the tuna tool Copiar o linkLink copiado para a área de transferência!
tuna commands can manage individual CPUs. By using the tuna tool, you can perform the following actions:
- Isolate CPUs
- All tasks running on the specified CPU move to the next available CPU. Isolating a CPU makes this CPU unavailable by removing it from the affinity mask of all threads.
- Include CPUs
- Allows tasks to run on the specified CPU.
- Restore CPUs
- Restores the specified CPU to its previous configuration.
Prerequisites
-
The
tunatool is installed. For more information, see Installing the tuna tool.
Procedure
List all currently running processes:
ps ax | awk 'BEGIN { ORS="," }{ print $1 }'# ps ax | awk 'BEGIN { ORS="," }{ print $1 }' PID,1,2,3,4,5,6,8,10,11,12,13,14,15,16,17,19Copy to Clipboard Copied! Toggle word wrap Toggle overflow Display the thread list in the
tunainterface:tuna show_threads -t 'thread_list from above cmd'
# tuna show_threads -t 'thread_list from above cmd'Copy to Clipboard Copied! Toggle word wrap Toggle overflow Depending on your scenario, use this command to manage CPU affinity of processes with one of the following actions:
tuna [command] --cpus cpu_list
# tuna [command] --cpus cpu_listCopy to Clipboard Copied! Toggle word wrap Toggle overflow -
The cpu_list argument is a list of comma-separated CPU numbers, for example,
--cpus 0,2. -
To add a specific CPU to the current cpu_list, use, for example,
--cpus +0.
-
The cpu_list argument is a list of comma-separated CPU numbers, for example,
Depending on your scenario, perform one of the following actions:
To isolate a CPU, enter:
tuna isolate --cpus cpu_list
# tuna isolate --cpus cpu_listCopy to Clipboard Copied! Toggle word wrap Toggle overflow To include a CPU, enter:
tuna include --cpus cpu_list
# tuna include --cpus cpu_listCopy to Clipboard Copied! Toggle word wrap Toggle overflow
To use a system with four or more processors, make all
sshthreads run on CPU0and1and allhttpthreads on CPU2and3:tuna move --cpus 0,1 -t ssh*
# tuna move --cpus 0,1 -t ssh*Copy to Clipboard Copied! Toggle word wrap Toggle overflow tuna move --cpus 2,3 -t http\*
# tuna move --cpus 2,3 -t http\*Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
Verify the applied changes by displaying the current configuration:
tuna show_threads -t ssh*
# tuna show_threads -t ssh* pid SCHED_ rtpri affinity voluntary nonvoluntary cmd 855 OTHER 0 0,1 23 15 sshdCopy to Clipboard Copied! Toggle word wrap Toggle overflow tuna show_threads -t http\*
# tuna show_threads -t http\* pid SCHED_ rtpri affinity voluntary nonvoluntary cmd 855 OTHER 0 2,3 23 15 httpCopy to Clipboard Copied! Toggle word wrap Toggle overflow For more information, see the
/proc/cpuinfofile and thetuna(8)man page on your system.
24.4. Tuning IRQs by using the tuna tool Copiar o linkLink copiado para a área de transferência!
The /proc/interrupts file records the number of interrupts per IRQ, the type of interrupt, and the name of the device that is located at that IRQ.
Prerequisites
-
The
tunatool is installed. For more information, see Installing the tuna tool.
Procedure
View the current IRQs and their affinity:
tuna show_irqs users affinity
# tuna show_irqs # users affinity 0 timer 0 1 i8042 0 7 parport0 0Copy to Clipboard Copied! Toggle word wrap Toggle overflow Specify the list of IRQs to be affected by a command:
tuna <command> --irqs irq_list --cpus cpu_list
# tuna <command> --irqs irq_list --cpus cpu_listCopy to Clipboard Copied! Toggle word wrap Toggle overflow - The irq_list argument is a list of comma-separated IRQ numbers or user-name patterns.
-
Replace
<command>with, for example,--spread.
Move an interrupt to a specified CPU:
tuna show_irqs --irqs <128> tuna move --irqs 128 --cpus 3
# tuna show_irqs --irqs <128> users affinity 128 iwlwifi 0,1,2,3 # tuna move --irqs 128 --cpus 3Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
Replace 128 with the irq_list argument and
3with the cpu_list argument. -
The cpu_list argument is a list of comma-separated CPU numbers, for example,
--cpus 0,2. For more information, see Tuning CPUs by using the tuna tool.
-
Replace 128 with the irq_list argument and
Verification
Compare the state of the selected IRQs before and after moving any interrupt to a specified CPU:
tuna show_irqs --irqs 128
# tuna show_irqs --irqs 128 users affinity 128 iwlwifi 3Copy to Clipboard Copied! Toggle word wrap Toggle overflow For more information, see the
/proc/interruptsfile and thetuna(8)man page on your system.