aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/net/dsa/port.c
diff options
context:
space:
mode:
authorCosmin Ratiu <cratiu@nvidia.com>2024-10-01 13:37:07 +0300
committerJakub Kicinski <kuba@kernel.org>2024-10-04 11:33:46 -0700
commitd95f77f1196a9458f61a08faa0eb569cf6f03a84 (patch)
tree13d1c28b0727ae7e1156b50d2a6f1f89b91b97ed /net/dsa/port.c
parentnet/mlx5: hw counters: Replace IDR+lists with xarray (diff)
downloadwireguard-linux-d95f77f1196a9458f61a08faa0eb569cf6f03a84.tar.xz
wireguard-linux-d95f77f1196a9458f61a08faa0eb569cf6f03a84.zip
net/mlx5: hw counters: Drop unneeded cacheline alignment
The mlx5_fc struct has a cache for values queried from hw, which is cacheline aligned. On x86_64, this results in: struct mlx5_fc { u32 id; /* 0 4 */ bool aging; /* 4 1 */ /* XXX 3 bytes hole, try to pack */ struct mlx5_fc_bulk * bulk; /* 8 8 */ /* XXX 48 bytes hole, try to pack */ /* --- cacheline 1 boundary (64 bytes) --- */ struct mlx5_fc_cache cache __attribute__((__aligned__(64))); /* 64 24 */ u64 lastpackets; /* 88 8 */ u64 lastbytes; /* 96 8 */ /* size: 128, cachelines: 2, members: 6 */ /* sum members: 53, holes: 2, sum holes: 51 */ /* padding: 24 */ /* forced aligns: 1, forced holes: 1, sum forced holes: 48 */ } __attribute__((__aligned__(64))); (output from pahole). ...So a 48+24=72 byte waste. As far as I can determine, this serves no purpose other than maybe making sure that the values in the cache do not span two cachelines in the worst case scenario, but that's not a valid enough reason to waste 72 bytes per counter, especially since this code is not performance-critical. There could potentially be hundreds of thousands of counters (e.g. for connection-tracking), so this quickly adds up to multiple MB wasted. This commit removes the alignment, resulting in: struct mlx5_fc { [...] /* size: 56, cachelines: 1, members: 6 */ /* sum members: 53, holes: 1, sum holes: 3 */ /* last cacheline: 56 bytes */ }; Signed-off-by: Cosmin Ratiu <cratiu@nvidia.com> Signed-off-by: Tariq Toukan <tariqt@nvidia.com> Link: https://patch.msgid.link/20241001103709.58127-5-tariqt@nvidia.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/dsa/port.c')
0 files changed, 0 insertions, 0 deletions