Pre-allocating a large number of mlx5 ktls tags can greatly increase the boot time when done synchronously. At Netflix, we've seen watchdog resets due to slow boottimes that I tracked to tls tag preallocation using @cperciva 's boot timestamping / flamegraphs.
Change tag preallocation to happen asynchronously when an interface is brought up
- a new mlx5-tls-prealloc_wq is allocated when preallocation is desired, and started when an interface is opened
- the bulk of the prealloc code remains the same, except the allocations are now M_NOWAIT M_NOWAIT is needed because, since the preallocation is done asynchronously, and since tag allocation is not instant, we could race with a real TLS session trying to allocate a tag. Note that in this case, we take allocation failure as a sign that we were unable to obtain the entire zone due to there being other consumers. This was suggested by @markj as a way to keep things simple, after discussing why uma_zone_get_cur() didn't immediately report a fully allocated zone. If this turns out to be problematic, we could use uma_zone_set_maxaction() to stop pre-allocations (also suggested by Mark)