* [PATCH net v2] net: don't keep lonely packets forever in the gro hash
@ 2018-11-21 17:21 Paolo Abeni
2018-11-21 17:33 ` Willem de Bruijn
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Paolo Abeni @ 2018-11-21 17:21 UTC (permalink / raw)
To: netdev; +Cc: David S. Miller, Willem de Bruijn, Eric Dumazet
Eric noted that with UDP GRO and NAPI timeout, we could keep a single
UDP packet inside the GRO hash forever, if the related NAPI instance
calls napi_gro_complete() at an higher frequency than the NAPI timeout.
Willem noted that even TCP packets could be trapped there, till the
next retransmission.
This patch tries to address the issue, flushing the old packets -
those with a NAPI_GRO_CB age before the current jiffy - before scheduling
the NAPI timeout. The rationale is that such a timeout should be
well below a jiffy and we are not flushing packets eligible for sane GRO.
v1 -> v2:
- clarified the commit message and comment
RFC -> v1:
- added 'Fixes tags', cleaned-up the wording.
Reported-by: Eric Dumazet <eric.dumazet@gmail.com>
Fixes: 3b47d30396ba ("net: gro: add a per device gro flush timer")
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
---
net/core/dev.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/net/core/dev.c b/net/core/dev.c
index 066aa902d85c..ddc551f24ba2 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -5970,11 +5970,14 @@ bool napi_complete_done(struct napi_struct *n, int work_done)
if (work_done)
timeout = n->dev->gro_flush_timeout;
+ /* When the NAPI instance uses a timeout and keeps postponing
+ * it, we need to bound somehow the time packets are kept in
+ * the GRO layer
+ */
+ napi_gro_flush(n, !!timeout);
if (timeout)
hrtimer_start(&n->timer, ns_to_ktime(timeout),
HRTIMER_MODE_REL_PINNED);
- else
- napi_gro_flush(n, false);
}
if (unlikely(!list_empty(&n->poll_list))) {
/* If n->poll_list is not empty, we need to mask irqs */
--
2.17.2
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH net v2] net: don't keep lonely packets forever in the gro hash
2018-11-21 17:21 [PATCH net v2] net: don't keep lonely packets forever in the gro hash Paolo Abeni
@ 2018-11-21 17:33 ` Willem de Bruijn
2018-11-21 17:42 ` Eric Dumazet
2018-11-23 19:19 ` David Miller
2 siblings, 0 replies; 4+ messages in thread
From: Willem de Bruijn @ 2018-11-21 17:33 UTC (permalink / raw)
To: Paolo Abeni; +Cc: Network Development, David Miller, Eric Dumazet
On Wed, Nov 21, 2018 at 12:21 PM Paolo Abeni <pabeni@redhat.com> wrote:
>
> Eric noted that with UDP GRO and NAPI timeout, we could keep a single
> UDP packet inside the GRO hash forever, if the related NAPI instance
> calls napi_gro_complete() at an higher frequency than the NAPI timeout.
> Willem noted that even TCP packets could be trapped there, till the
> next retransmission.
> This patch tries to address the issue, flushing the old packets -
> those with a NAPI_GRO_CB age before the current jiffy - before scheduling
> the NAPI timeout. The rationale is that such a timeout should be
> well below a jiffy and we are not flushing packets eligible for sane GRO.
>
> v1 -> v2:
> - clarified the commit message and comment
>
> RFC -> v1:
> - added 'Fixes tags', cleaned-up the wording.
>
> Reported-by: Eric Dumazet <eric.dumazet@gmail.com>
> Fixes: 3b47d30396ba ("net: gro: add a per device gro flush timer")
> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Acked-by: Willem de Bruijn <willemb@google.com>
Thanks for making those small changes.
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH net v2] net: don't keep lonely packets forever in the gro hash
2018-11-21 17:21 [PATCH net v2] net: don't keep lonely packets forever in the gro hash Paolo Abeni
2018-11-21 17:33 ` Willem de Bruijn
@ 2018-11-21 17:42 ` Eric Dumazet
2018-11-23 19:19 ` David Miller
2 siblings, 0 replies; 4+ messages in thread
From: Eric Dumazet @ 2018-11-21 17:42 UTC (permalink / raw)
To: Paolo Abeni, netdev; +Cc: David S. Miller, Willem de Bruijn
On 11/21/2018 09:21 AM, Paolo Abeni wrote:
> Eric noted that with UDP GRO and NAPI timeout, we could keep a single
> UDP packet inside the GRO hash forever, if the related NAPI instance
> calls napi_gro_complete() at an higher frequency than the NAPI timeout.
Acked-by: Eric Dumazet <edumazet@google.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net v2] net: don't keep lonely packets forever in the gro hash
2018-11-21 17:21 [PATCH net v2] net: don't keep lonely packets forever in the gro hash Paolo Abeni
2018-11-21 17:33 ` Willem de Bruijn
2018-11-21 17:42 ` Eric Dumazet
@ 2018-11-23 19:19 ` David Miller
2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2018-11-23 19:19 UTC (permalink / raw)
To: pabeni; +Cc: netdev, willemdebruijn.kernel, eric.dumazet
From: Paolo Abeni <pabeni@redhat.com>
Date: Wed, 21 Nov 2018 18:21:35 +0100
> Eric noted that with UDP GRO and NAPI timeout, we could keep a single
> UDP packet inside the GRO hash forever, if the related NAPI instance
> calls napi_gro_complete() at an higher frequency than the NAPI timeout.
> Willem noted that even TCP packets could be trapped there, till the
> next retransmission.
> This patch tries to address the issue, flushing the old packets -
> those with a NAPI_GRO_CB age before the current jiffy - before scheduling
> the NAPI timeout. The rationale is that such a timeout should be
> well below a jiffy and we are not flushing packets eligible for sane GRO.
>
> v1 -> v2:
> - clarified the commit message and comment
>
> RFC -> v1:
> - added 'Fixes tags', cleaned-up the wording.
>
> Reported-by: Eric Dumazet <eric.dumazet@gmail.com>
> Fixes: 3b47d30396ba ("net: gro: add a per device gro flush timer")
> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Applied and queued up for -stable.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-11-24 6:05 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-11-21 17:21 [PATCH net v2] net: don't keep lonely packets forever in the gro hash Paolo Abeni
2018-11-21 17:33 ` Willem de Bruijn
2018-11-21 17:42 ` Eric Dumazet
2018-11-23 19:19 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).