Implement buf_ring/drbr deferred transmit in iflib. This is intended to allow the new simpler code path to replace mp_ring. This patch makes the simple_tx outperform mp_ring by a wide margin when CPU is the bottleneck (eg, cannot fill the NIC). See graphs at: https://people.freebsd.org/~gallatin/mpring_vs_simple_tx Note that the buf ring is used for contention, not capacity. Eg, it is used as a place for contending threads to put packets without waiting for a mutex. It is not designed to act as a software ring on top of the hardware descriptors provided by the underlying NIC driver. "stranded packets" are exceedingly rare due to the fact that if there is enough load to use the buf_ring, there will probably be more load coming that can be a drainer. Not scheduling a gtask to drain is intentional, and we really on the timer as a fallback. One thing I noticed while developing this patch is that a simple mutex with no deferral generally outperformed both mp_ring and drbr at high levels of contention for the same queue. This is inherent in a bounded MPSC queue where multiple producers are contending on claiming ring entries. So I came up with the idea of bounding the number of producers such that the deferral ring would devolve to a mutex when contention was high. Identifying the crossover point in a general way was hard. On different machines, the point between a mutex and a deferral ring was very different and also depended on the placement of the producers. I eventually realized that on the large AMD EPYC servers that I was testing on, the crossover point generally coincided with the work spilling into another CCX. So I developed an approach where we limit the number of producers by limiting simultanious producers to the same L3 AND by bounding the number of simultanious producers. This limit can be adjusted via the sysctl net.iflib.max_producers. The number of packets drained from the deferral ring is limited by net.iflib.simple_drain_quota. The intent is to process just enough packets in the gtaskq context so as to make space to allow threads to make progress. The task also uses a trylock so as to avoid blocking, waiting for a thread to drain. This change also enables ALTQ support for simple tx. Reviewed by: kbowling Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D58901
FreeBSD Source:
This is the top level of the FreeBSD source directory.
FreeBSD is an operating system used to power modern servers, desktops, and embedded platforms. A large community has continually developed it for more than thirty years. Its advanced networking, security, and storage features have made FreeBSD the platform of choice for many of the busiest web sites and most pervasive embedded networking and storage devices.
For copyright information, please see the file COPYRIGHT in this directory. Additional copyright information also exists for some sources in this tree - please see the specific source directories for more information.
The Makefile in this directory supports a number of targets for building components (or all) of the FreeBSD source tree. See build(7), config(8), FreeBSD handbook on building userland, and Handbook for kernels for more information, including setting make(1) variables.
For information on the CPU architectures and platforms supported by FreeBSD, see the FreeBSD website's Platforms page.
For official FreeBSD bootable images, see the release page.
Source Roadmap:
| Directory | Description |
|---|---|
| bin | System/user commands. |
| cddl | Source code for third-party software under the Common Development and Distribution License. |
| contrib | Source code for third-party software. |
| crypto | Source code for cryptographic libraries and commands (see crypto/README). |
| etc | Template files for /etc. |
| include | System include files. |
| kerberos5 | Build system for Kerberos 5 (Heimdal). |
| krb5 | Build system for Kerberos 5 (MIT). |
| lib | System libraries. |
| libexec | System commands intended to be executed by other commands or daemons. |
| packages | Base system packages. |
| release | Makefiles and scripts used for building releases and VM images. |
| rescue | Build system for statically linked /rescue commands. |
| sbin | System commands. |
| secure | Build system for cryptographic libraries and commands (excluding Kerberos). |
| share | Shared resources. |
| stand | Boot loader sources. |
| sys | Kernel sources (see sys/README.md). |
| targets | Support for experimental DIRDEPS_BUILD |
| tests | Tests which can be run by Kyua. See tests/README for additional information. |
| tools | Ancillary utilities and tests (not included in the build). |
| usr.bin | User commands. |
| usr.sbin | System administration commands. |
For information on synchronizing your source tree with one or more of the FreeBSD Project's development branches, please see FreeBSD Handbook.