diff options
author | Breno Leitao <leitao@debian.org> | 2025-03-04 07:50:41 -0800 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2025-03-07 19:55:40 -0800 |
commit | 248f6571fd4c51531f7f8f07f186f7ae98a50afc (patch) | |
tree | f325b40fbd4b79baa1534948faa289376ebb2eae /net/core/dev_api.c | |
parent | fca9fe1aae4478c9b8f360169801f62b3da12d71 (diff) | |
download | linux-248f6571fd4c51531f7f8f07f186f7ae98a50afc.tar.gz linux-248f6571fd4c51531f7f8f07f186f7ae98a50afc.tar.bz2 linux-248f6571fd4c51531f7f8f07f186f7ae98a50afc.zip |
netpoll: Optimize skb refilling on critical path
netpoll tries to refill the skb queue on every packet send, independently
if packets are being consumed from the pool or not. This was
particularly problematic while being called from printk(), where the
operation would be done while holding the console lock.
Introduce a more intelligent approach to skb queue management. Instead
of constantly attempting to refill the queue, the system now defers
refilling to a work queue and only triggers the workqueue when a buffer
is actually dequeued. This change significantly reduces operations with
the lock held.
Add a work_struct to the netpoll structure for asynchronous refilling,
updating find_skb() to schedule refill work only when necessary (skb is
dequeued).
These changes have demonstrated a 15% reduction in time spent during
netpoll_send_msg operations, especially when no SKBs are not consumed
from consumed from pool.
When SKBs are being dequeued, the improvement is even better, around
70%, mainly because refilling the SKB pool is now happening outside of
the critical patch (with console_owner lock held).
Signed-off-by: Breno Leitao <leitao@debian.org>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20250304-netpoll_refill_v2-v1-1-06e2916a4642@debian.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/core/dev_api.c')
0 files changed, 0 insertions, 0 deletions