Okay, let's consider your Linux kernel version 5.4 in the context of the previous answer.
The core conclusion was that the kernel CPU cost is dominated by the total volume of outgoing packets and their size, while user-space cost is dominated by the number of matching SYN packets.
Does Kernel 5.4 change the fundamental conclusions?
No, not significantly.
Here's why:
-
BPF Efficiency: Kernel 5.4 is within the "modern kernels (5.x+)" range that we discussed. It fully supports the JIT (Just-In-Time) compilation of BPF filters to native machine code. This is the key optimization that makes BPF filtering very fast directly within the kernel networking stack.
- Compared to older kernels (e.g., 4.x or earlier), 5.4 already provides the significant performance uplift for BPF that we assumed when estimating the per-packet BPF cost at 50-100 cycles.
- While newer kernels (6.x+) might have further marginal improvements or support more advanced BPF features, the core efficiency for a simple filter like
ip6 and tcp and tcp-syn and out was already well-established and optimized in the 5.x series, including 5.4.
-
Packet Copy Mechanism: Kernel 5.4 supports efficient kernel-to-user packet copying mechanisms like TPACKET_V3, which uses mmap. This minimizes the overhead of getting the matched packets to tcpdump in user space. This was assumed in the previous analysis when we said the copy cost is minimal.
-
User-Space Processing: The kernel version doesn't directly affect how many CPU cycles tcpdump itself spends parsing the packet header in user space. This cost remains dependent on the number of matched packets, which you estimate at 16-166 per second. This rate is still extremely low for user-space processing on any modern CPU.
In summary:
Your kernel 5.4 is sufficiently modern to benefit from the optimized BPF filtering and efficient packet copying mechanisms that were the basis for the previous estimates.
- The kernel CPU cost will still be primarily determined by the total outgoing packets per second on your 25 Gbit interface, irrespective of the 5.4 version (because 5.4 is the version providing the efficiency). If your interface is saturated with small packets, kernel CPU could still be high. If traffic is low or consists of large packets, it will be low.
- The user-space CPU cost for
tcpdump will still be negligible for your expected SYN rate (16-166/sec).
So, the core takeaway remains: monitor your total outgoing PPS to estimate the kernel cost, and don't worry about the user-space cost, as it will be trivial for your scenario with kernel 5.4.