Commit 6f8b12d
net: napi: add hard irqs deferral feature
Back in commit 3b47d30 ("net: gro: add a per device gro flush timer")
we added the ability to arm one high resolution timer, that we used
to keep not-complete packets in GRO engine a bit longer, hoping that further
frames might be added to them.
Since then, we added the napi_complete_done() interface, and commit
364b605 ("net: busy-poll: return busypolling status to drivers")
allowed drivers to avoid re-arming NIC interrupts if we made a promise
that their NAPI poll() handler would be called in the near future.
This infrastructure can be leveraged, thanks to a new device parameter,
which allows to arm the napi hrtimer, instead of re-arming the device
hard IRQ.
We have noticed that on some servers with 32 RX queues or more, the chit-chat
between the NIC and the host caused by IRQ delivery and re-arming could hurt
throughput by ~20% on 100Gbit NIC.
In contrast, hrtimers are using local (percpu) resources and might have lower
cost.
The new tunable, named napi_defer_hard_irqs, is placed in the same hierarchy
than gro_flush_timeout (/sys/class/net/ethX/)
By default, both gro_flush_timeout and napi_defer_hard_irqs are zero.
This patch does not change the prior behavior of gro_flush_timeout
if used alone : NIC hard irqs should be rearmed as before.
One concrete usage can be :
echo 20000 >/sys/class/net/eth1/gro_flush_timeout
echo 10 >/sys/class/net/eth1/napi_defer_hard_irqs
If at least one packet is retired, then we will reset napi counter
to 10 (napi_defer_hard_irqs), ensuring at least 10 periodic scans
of the queue.
On busy queues, this should avoid NIC hard IRQ, while before this patch IRQ
avoidance was only possible if napi->poll() was exhausting its budget
and not call napi_complete_done().
This feature also can be used to work around some non-optimal NIC irq
coalescing strategies.
Having the ability to insert XX usec delays between each napi->poll()
can increase cache efficiency, since we increase batch sizes.
It also keeps serving cpus not idle too long, reducing tail latencies.
Co-developed-by: Luigi Rizzo <lrizzo@google.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>1 parent e6acd2b commit 6f8b12d
3 files changed
+38
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
329 | 329 | | |
330 | 330 | | |
331 | 331 | | |
| 332 | + | |
332 | 333 | | |
333 | 334 | | |
334 | 335 | | |
| |||
1995 | 1996 | | |
1996 | 1997 | | |
1997 | 1998 | | |
| 1999 | + | |
1998 | 2000 | | |
1999 | 2001 | | |
2000 | 2002 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6227 | 6227 | | |
6228 | 6228 | | |
6229 | 6229 | | |
6230 | | - | |
| 6230 | + | |
| 6231 | + | |
6231 | 6232 | | |
6232 | 6233 | | |
6233 | 6234 | | |
| |||
6239 | 6240 | | |
6240 | 6241 | | |
6241 | 6242 | | |
6242 | | - | |
6243 | | - | |
6244 | | - | |
6245 | | - | |
| 6243 | + | |
| 6244 | + | |
6246 | 6245 | | |
6247 | | - | |
| 6246 | + | |
| 6247 | + | |
| 6248 | + | |
| 6249 | + | |
| 6250 | + | |
| 6251 | + | |
| 6252 | + | |
| 6253 | + | |
| 6254 | + | |
6248 | 6255 | | |
6249 | 6256 | | |
6250 | 6257 | | |
6251 | 6258 | | |
6252 | 6259 | | |
6253 | | - | |
6254 | | - | |
6255 | | - | |
6256 | 6260 | | |
6257 | 6261 | | |
6258 | 6262 | | |
| |||
6284 | 6288 | | |
6285 | 6289 | | |
6286 | 6290 | | |
6287 | | - | |
| 6291 | + | |
| 6292 | + | |
| 6293 | + | |
| 6294 | + | |
6288 | 6295 | | |
6289 | 6296 | | |
6290 | 6297 | | |
| |||
6464 | 6471 | | |
6465 | 6472 | | |
6466 | 6473 | | |
6467 | | - | |
| 6474 | + | |
6468 | 6475 | | |
6469 | 6476 | | |
6470 | 6477 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
382 | 382 | | |
383 | 383 | | |
384 | 384 | | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
385 | 402 | | |
386 | 403 | | |
387 | 404 | | |
| |||
545 | 562 | | |
546 | 563 | | |
547 | 564 | | |
| 565 | + | |
548 | 566 | | |
549 | 567 | | |
550 | 568 | | |
| |||
0 commit comments