Commit f3483c8
net: rfs: hash function change
RFS is using two kinds of hash tables.
First one is controlled by /proc/sys/net/core/rps_sock_flow_entries = 2^N
and using the N low order bits of the l4 hash is good enough.
Then each RX queue has its own hash table, controlled by
/sys/class/net/eth1/queues/rx-$q/rps_flow_cnt = 2^X
Current hash function, using the X low order bits is suboptimal,
because RSS is usually using Func(hash) = (hash % power_of_two);
For example, with 32 RX queues, 6 low order bits have no entropy
for a given queue.
Switch this hash function to hash_32(hash, log) to increase
chances to use all possible slots and reduce collisions.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Tom Herbert <tom@herbertland.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20250321171309.634100-1-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>1 parent 1952e19 commit f3483c8
3 files changed
Lines changed: 12 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
| 42 | + | |
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4751 | 4751 | | |
4752 | 4752 | | |
4753 | 4753 | | |
| 4754 | + | |
| 4755 | + | |
| 4756 | + | |
| 4757 | + | |
| 4758 | + | |
4754 | 4759 | | |
4755 | 4760 | | |
4756 | 4761 | | |
| |||
4777 | 4782 | | |
4778 | 4783 | | |
4779 | 4784 | | |
4780 | | - | |
| 4785 | + | |
4781 | 4786 | | |
4782 | 4787 | | |
4783 | 4788 | | |
| |||
4856 | 4861 | | |
4857 | 4862 | | |
4858 | 4863 | | |
4859 | | - | |
| 4864 | + | |
4860 | 4865 | | |
4861 | 4866 | | |
4862 | 4867 | | |
| |||
4923 | 4928 | | |
4924 | 4929 | | |
4925 | 4930 | | |
4926 | | - | |
| 4931 | + | |
4927 | 4932 | | |
4928 | 4933 | | |
4929 | 4934 | | |
4930 | 4935 | | |
4931 | 4936 | | |
4932 | | - | |
| 4937 | + | |
4933 | 4938 | | |
4934 | 4939 | | |
4935 | 4940 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1056 | 1056 | | |
1057 | 1057 | | |
1058 | 1058 | | |
1059 | | - | |
| 1059 | + | |
1060 | 1060 | | |
1061 | 1061 | | |
1062 | 1062 | | |
| |||
1109 | 1109 | | |
1110 | 1110 | | |
1111 | 1111 | | |
1112 | | - | |
| 1112 | + | |
1113 | 1113 | | |
1114 | 1114 | | |
1115 | 1115 | | |
| |||
0 commit comments