-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'net-introduce-rps_default_mask'
Paolo Abeni says: ==================== net: introduce rps_default_mask Real-time setups try hard to ensure proper isolation between time critical applications and e.g. network processing performed by the network stack in softirq and RPS is used to move the softirq activity away from the isolated core. If the network configuration is dynamic, with netns and devices routinely created at run-time, enforcing the correct RPS setting on each newly created device allowing to transient bad configuration became complex. Additionally, when multi-queue devices are involved, configuring rps in user-space on each queue easily becomes very expensive, e.g. some setups use veths with per cpu queues. These series try to address the above, introducing a new sysctl knob: rps_default_mask. The new sysctl entry allows configuring a netns-wide RPS mask, to be enforced since receive queue creation time without any fourther per device configuration required. Additionally, a simple self-test is introduced to check the rps_default_mask behavior. ==================== Link: https://lore.kernel.org/r/cover.1675789134.git.pabeni@redhat.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
- Loading branch information
Showing
8 changed files
with
182 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#!/bin/sh | ||
# SPDX-License-Identifier: GPL-2.0 | ||
|
||
readonly ksft_skip=4 | ||
readonly cpus=$(nproc) | ||
ret=0 | ||
|
||
[ $cpus -gt 2 ] || exit $ksft_skip | ||
|
||
readonly INITIAL_RPS_DEFAULT_MASK=$(cat /proc/sys/net/core/rps_default_mask) | ||
readonly NETNS="ns-$(mktemp -u XXXXXX)" | ||
|
||
setup() { | ||
ip netns add "${NETNS}" | ||
ip -netns "${NETNS}" link set lo up | ||
} | ||
|
||
cleanup() { | ||
echo $INITIAL_RPS_DEFAULT_MASK > /proc/sys/net/core/rps_default_mask | ||
ip netns del $NETNS | ||
} | ||
|
||
chk_rps() { | ||
local rps_mask expected_rps_mask=$3 | ||
local dev_name=$2 | ||
local msg=$1 | ||
|
||
rps_mask=$(ip netns exec $NETNS cat /sys/class/net/$dev_name/queues/rx-0/rps_cpus) | ||
printf "%-60s" "$msg" | ||
if [ $rps_mask -eq $expected_rps_mask ]; then | ||
echo "[ ok ]" | ||
else | ||
echo "[fail] expected $expected_rps_mask found $rps_mask" | ||
ret=1 | ||
fi | ||
} | ||
|
||
trap cleanup EXIT | ||
|
||
echo 0 > /proc/sys/net/core/rps_default_mask | ||
setup | ||
chk_rps "empty rps_default_mask" lo 0 | ||
cleanup | ||
|
||
echo 1 > /proc/sys/net/core/rps_default_mask | ||
setup | ||
chk_rps "non zero rps_default_mask" lo 1 | ||
|
||
echo 3 > /proc/sys/net/core/rps_default_mask | ||
chk_rps "changing rps_default_mask dont affect existing netns" lo 1 | ||
|
||
ip -n $NETNS link add type veth | ||
ip -n $NETNS link set dev veth0 up | ||
ip -n $NETNS link set dev veth1 up | ||
chk_rps "changing rps_default_mask affect newly created devices" veth0 3 | ||
chk_rps "changing rps_default_mask affect newly created devices[II]" veth1 3 | ||
exit $ret |