Re: [net-next v1] net: ipv6: avoid overhead when no custom FIB rules are installed
flat view
From: Jiri Pirko <jiri@resnulli.us>
Date: 2017-08-08 12:51:35
Tue, Aug 08, 2017 at 01:51:21PM CEST, vincent@bernat.im wrote:
If the user hasn't installed any custom rules, don't go through the
whole FIB rules layer. This is pretty similar to f4530fa574df (ipv4:
Avoid overhead when no custom FIB rules are installed).
Using a micro-benchmark module [1], timing ip6_route_output() using
get_cycles(), on my laptop with performance governor (so, subject to
some caution due to thermal throttling), with 40,000 routes in the main
routing table, before this patch:
min=603 max=12477 count=627 average=1926 95th=4518 90th=3661 50th=1600 mad=724
table=254 avgdepth=21.8 maxdepth=39
value │ ┊ count
600 │▒▒▒▒▒▒▒▒▒▒ 134
860 │▒▒▒▒▒▒▒░░░░░░░░░░ 91
1120 │▒▒▒░░░░░░░░░░░░░░░░░░ 39
1380 │▒▒▒▒░░░░░░░░░░░░░░░░░░░░░ 58
1640 │▒▒▒▒░░░░░░░░░░░░░░░░░░░░░░░░░░ 57
1900 │▒▒▒▒░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 58
2160 │▒▒▒░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 46
2420 │▒▒░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 26
2680 │▒▒░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 27
2940 │▒░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 15
3200 │░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 8
3460 │░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 8
3720 │░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 12
3980 │░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 9
4240 │░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 7
4500 │░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 6
After:
min=486 max=12390 count=627 average=1715 95th=4365 90th=3352 50th=1324 mad=631
table=254 avgdepth=21.8 maxdepth=39
value │ ┊ count
480 │▒▒▒▒▒▒▒▒▒▒▒▒ 153
730 │▒▒▒▒▒▒▒░░░░░░░░░░░░ 88
980 │▒▒▒▒░░░░░░░░░░░░░░░░░░░ 57
1230 │▒▒▒▒░░░░░░░░░░░░░░░░░░░░░░░░ 56
1480 │▒▒▒░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 43
1730 │▒▒▒░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 50
1980 │▒▒░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 31
2230 │▒░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 23
2480 │▒░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 15
2730 │▒░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 23
2980 │▒░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 20
3230 │▒░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 14
3480 │░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 4
3730 │░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 8
3980 │░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 9
4230 │░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 4Cool graphs!
At the frequency of the laptop during the bench (~ 2.3 GHz), this is about a 130 ns difference on the median value and 50 ns on the minimal value. A next step would be to collapse local and main tables, as in 0ddcf43d5d4a (ipv4: FIB Local/MAIN table collapse). [1]: https://github.com/vincentbernat/network-lab/blob/master/lab-routes-ipv6/kbench_mod.c Signed-off-by: Vincent Bernat <redacted>
Reviewed-by: Jiri Pirko <redacted>