Vieri l33t
Joined: 18 Dec 2005 Posts: 887
|
Posted: Fri Oct 25, 2019 11:10 am Post subject: linux process priority for ksoftirqd |
|
|
Hi,
I have a pretty busy network going through a Gentoo firewall/router. Lots of packets means my ksoftirqd processes are using quite a lot of CPU. I'm trying to optimize my NIC settings, but I think I can't get any better unless I change hardware.
However, I want to make sure I prioritize CPU power for the ksoftirqd processes because I noticed that if by any chance another process runs on any of my 8 cores at a high rate (100% CPU) then the network usually lags for a short while.
Code: | root 3 2.2 0.0 0 0 ? S Oct10 490:59 [ksoftirqd/0]
root 14 4.0 0.0 0 0 ? S Oct10 882:36 [ksoftirqd/1]
root 19 2.2 0.0 0 0 ? S Oct10 480:08 [ksoftirqd/2]
root 24 3.4 0.0 0 0 ? S Oct10 761:05 [ksoftirqd/3]
root 29 2.0 0.0 0 0 ? S Oct10 441:51 [ksoftirqd/4]
root 34 3.5 0.0 0 0 ? S Oct10 769:20 [ksoftirqd/5]
root 39 3.6 0.0 0 0 ? S Oct10 805:29 [ksoftirqd/6]
root 44 8.9 0.0 0 0 ? S Oct10 1945:55 [ksoftirqd/7]
|
So I'm wondering how to make sure that the ksoftirqd process is always guaranteed to have (eg.) up to 50% cpu for it (per core).
In other words, if another resource-hungry process starts on eg. core 3 and would normally eat up 100% power, how do I make sure that ksoftirqd wil always have the upper hand?
Alternatively, although less efficient, how can I tell the OS to "dedicate" cores 0-6 to ksoftirqd (and NOT run ksoftirqd on core 7), and "dedicate" core 7 to "everything else"?
Code: | # ps ax -o pid,ni,cmd | grep ksoftirqd
3 0 [ksoftirqd/0]
14 0 [ksoftirqd/1]
19 0 [ksoftirqd/2]
24 0 [ksoftirqd/3]
29 0 [ksoftirqd/4]
34 0 [ksoftirqd/5]
39 0 [ksoftirqd/6]
44 0 [ksoftirqd/7]
|
"top"'s PR value is 20 for ksoftirqd. It's also 20 for most "normal" processes (userland).
The lower the PR value the higher the priority, right?
So how can I change the priority of ksoftirqd and why isn't it already higher by default?
[EDIT]
Code: | # ps aux | grep ksoftirqd
root 3 2.2 0.0 0 0 ? S Oct10 490:59 [ksoftirqd/0]
root 14 4.0 0.0 0 0 ? S Oct10 882:36 [ksoftirqd/1]
root 19 2.1 0.0 0 0 ? S Oct10 480:09 [ksoftirqd/2]
root 24 3.4 0.0 0 0 ? S Oct10 761:05 [ksoftirqd/3]
root 29 2.0 0.0 0 0 ? S Oct10 441:52 [ksoftirqd/4]
root 34 3.5 0.0 0 0 ? S Oct10 769:21 [ksoftirqd/5]
root 39 3.6 0.0 0 0 ? S Oct10 805:30 [ksoftirqd/6]
root 44 8.8 0.0 0 0 ? S Oct10 1945:56 [ksoftirqd/7]
# chrt -p 3
pid 3's current scheduling policy: SCHED_OTHER
pid 3's current scheduling priority: 0
# chrt -p 14
pid 14's current scheduling policy: SCHED_OTHER
pid 14's current scheduling priority: 0
[...]
# chrt -p 44
pid 44's current scheduling policy: SCHED_OTHER
pid 44's current scheduling priority: 0
|
Should I use chrt or renice to change the priority? (how exactly?)
Would changing CONFIG_PREEMPT* values when recompiling the kernel help a Linux router?
I haven't found a clear guide for that yet. |
|