[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240207095549.00237661@kernel.org>
Date: Wed, 7 Feb 2024 09:55:49 -0800
From: Jakub Kicinski <kuba@...nel.org>
To: Eric Dumazet <edumazet@...gle.com>
Cc: "David S . Miller" <davem@...emloft.net>, Paolo Abeni
<pabeni@...hat.com>, netdev@...r.kernel.org, eric.dumazet@...il.com
Subject: Re: [PATCH net-next] net-procfs: use xarray iterator to implement
/proc/net/dev
On Wed, 7 Feb 2024 16:53:18 +0000 Eric Dumazet wrote:
> In commit 759ab1edb56c ("net: store netdevs in an xarray")
> Jakub added net->dev_by_index to map ifindex to netdevices.
>
> We can get rid of the old hash table (net->dev_index_head),
> one patch at a time, if performance is acceptable.
FWIW there was a basic benchmark result in that commit:
#devs | hash | xa | delta
2 | 18.3 | 20.1 | + 9.8%
16 | 18.3 | 20.1 | + 9.5%
64 | 18.3 | 26.3 | +43.8%
128 | 20.4 | 26.3 | +28.6%
256 | 20.0 | 26.4 | +32.1%
1024 | 26.6 | 26.7 | + 0.2%
8192 |541.3 | 33.5 | -93.8%
The microbenchmark scans indexes in order, if the pattern is more
random xa starts to win at 512 devices already. But that's a lot
of devices, in practice.
obviously not a very realistic load, but I wanted to mention that,
in case you were planning to do similar testing. Having
wasted few hours yesterday reimplementing tls fixes Sabrina
already posted makes me hyper-vigilant now about people
repeating work ;)
> This patch removes unpleasant code to something more readable.
>
> As a bonus, /proc/net/dev gets netdevices sorted by their ifindex.
>
> Signed-off-by: Eric Dumazet <edumazet@...gle.com>
Reviewed-by: Jakub Kicinski <kuba@...nel.org>
Powered by blists - more mailing lists