Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ all: hp0 hp3
hp0:
scp -C ./hp0/* hp0:
scp -C ./modules/* hp0:
scp -C ./scripts/* hp0:
scp -C ./nix_switch.bash hp0:

hp3:
scp -C ./hp3/* hp3:
scp -C ./modules/* hp3:
scp -C ./scripts/* hp3:
scp -C ./nix_switch.bash hp3:

#
Expand Down
1 change: 1 addition & 0 deletions hp0/configuration.nix
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
./hosts.nix
./firewall.nix
./il8n.nix
./systemdSystem.nix
./systemPackages.nix
./home-manager.nix
];
Expand Down
1 change: 1 addition & 0 deletions hp3/configuration.nix
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
./hosts.nix
./firewall.nix
./il8n.nix
./systemdSystem.nix
./systemPackages.nix
./home-manager.nix
];
Expand Down
14 changes: 14 additions & 0 deletions modules/systemdSystem.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{ config, pkgs, ... }:

{
# https://github.com/NixOS/nixpkgs/blob/095f1acb70302bd74cd5f3ab02a64bdfac36daa8/nixos/modules/system/boot/systemd.nix#L534
# https://discourse.nixos.org/t/overriding-modifying-systemd-unit-file/45621/7

# https://mynixos.com/nixpkgs/options/systemd
systemd.extraConfig = "CPUAffinity=2-7";

#https://mynixos.com/options/systemd.user
systemd.user.extraConfig = "CPUAffinity=2-7";
# create your own service
# https://discourse.nixos.org/t/how-to-use-toplevel-overrides-for-systemd/12501
}
3 changes: 3 additions & 0 deletions nix_switch.bash
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@
#
sudo cp ./*.nix /etc/nixos/
sudo nixos-rebuild switch


#sudo ln -s /run/current-system/sw/bin/bash /usr/bin/bash
45 changes: 45 additions & 0 deletions scripts/pin_nic_irqs.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/usr/bin/bash
#
# This script pins iwlwifi and enp1 to cores 0-1
#
# https://www.kernel.org/doc/Documentation/IRQ-affinity.txt
# https://linux-kernel-labs.github.io/refs/heads/master/lectures/interrupts.html#interrupt-handling-in-linux
# in future consider
# https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/performance_tuning_guide/network-rps

# [das@hp0:~]$ cat /proc/interrupts | grep wifi
# 86: 0 0 0 4361163 0 0 0 0 IR-PCI-MSIX-0000:03:00.0 0-edge iwlwifi:default_queue
# 87: 527141 0 0 0 0 0 0 0 IR-PCI-MSIX-0000:03:00.0 1-edge iwlwifi:queue_1
# 88: 0 36601 0 0 0 0 0 0 IR-PCI-MSIX-0000:03:00.0 2-edge iwlwifi:queue_2
# 89: 0 0 549109 0 0 0 0 0 IR-PCI-MSIX-0000:03:00.0 3-edge iwlwifi:queue_3
# 90: 0 0 0 393223 0 0 0 0 IR-PCI-MSIX-0000:03:00.0 4-edge iwlwifi:queue_4
# 91: 0 0 0 0 1776763 0 0 0 IR-PCI-MSIX-0000:03:00.0 5-edge iwlwifi:queue_5
# 92: 0 0 0 0 0 159677 0 0 IR-PCI-MSIX-0000:03:00.0 6-edge iwlwifi:queue_6
# 93: 0 0 0 0 0 0 295033 0 IR-PCI-MSIX-0000:03:00.0 7-edge iwlwifi:queue_7
# 94: 0 0 0 0 0 0 0 642178 IR-PCI-MSIX-0000:03:00.0 8-edge iwlwifi:queue_8
# 95: 0 0 0 0 3 0 0 0 IR-PCI-MSIX-0000:03:00.0 9-edge iwlwifi:exception
# grep iwlwifi /proc/interrupts | awk '{ print $1 }' | sed -e 's/://'

echo "starting to pin"
echo "BEFORE"
echo "grep iwlwifi /proc/interrupts"
grep iwlwifi /proc/interrupts

for i in {86..95}
do
echo "Loop:${i}"
echo "echo 0-1 > /proc/irq/${i}/smp_affinity_list"
echo 0-1 > /proc/irq/"${i}"/smp_affinity_list
echo "cat /proc/irq/${i}/smp_affinity_list"
cat /proc/irq/"${i}"/smp_affinity_list
done

echo "AFTER"
echo "grep iwlwifi /proc/interrupts"
grep iwlwifi /proc/interrupts

#[das@hp0:~]$ grep eno /proc/interrupts
# 83: 0 0 0 0 0 0 0 0 IR-PCI-MSIX-0000:05:00.0 0-edge eno1

echo "echo 0-1 > /proc/irq/83/smp_affinity_list"
echo 0-1 > /proc/irq/83/smp_affinity_list