Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp8095893imu; Tue, 4 Dec 2018 02:56:24 -0800 (PST) X-Google-Smtp-Source: AFSGD/WuXRzAHCg4NANYxWnsVEp19tmS/EYVnpoMVVmscvb5v/wA7kUJ0EBIkab4nFwfpON1+bpc X-Received: by 2002:a63:2e88:: with SMTP id u130mr16723027pgu.9.1543920984411; Tue, 04 Dec 2018 02:56:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543920984; cv=none; d=google.com; s=arc-20160816; b=KIWf7tYKxxso3cZ8Umwz/t5y8n8WhFGFFmxqAlOlRgdDUfBObiyidowbv0BhCX7RPH 73t5fIIXur/cCW9hrXgxoI6GIjRqehOO7ibS5P+vGTZpYtYRG8SFe/wneA5n1BzB3Z12 Pvw4jwdlgQMc6GXViSGQvr9qrVWsTJrz4qc+PmWpGJ5xKXdwX7/z4sujNz6rnq4ikd5D OS6WlmpKepm/yZ56gFpbUSA2qHuViHx/DaTKFT8skwZyyd3GkVFPgMV6PerMnaDRPnB8 HC2FmO0RFK1AyvSGy3/lVKMllmWc09eXTcKn+UcfpjGEqOON+oFu0ttNnN3adpTlakpq 7ElA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=nQWkRzYPZoJR5nuQ5Sjwd5F8W9wxM6lXHFUiQ9LUVKA=; b=e/sR78DMYBA4yZJ6m8lQYnCT4PkQ0opMUjp5PV7nnzmzHTgArgkMGrHa1pLMeF5Bh5 Q7slZ9CcKz8o2iDVtEQJIh6PY0D3fkING0MUsNFQgkEPm5QTNrw2EumgE3g/q3JAlhg8 19u04ZjBU3paHRnL+jBhsdT8wXp7LBAlcbS5cXwGCTCVcie9qRtK1vc86kaRgkbk8pyT 0dIH1zzYrLdshyIa4aPif/8/2yaE/BKn8orpI4sNQhEqsSlyZpVVdVKNODXLwXIFifc1 TmVX5zNKW34egOpf2zvpnnf+YIc88+2onYBErMVqqdHOzfFwXJOiJZT21HicIwMWdrBM 5JXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=KjRFaaZJ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 187si17671333pfv.238.2018.12.04.02.56.09; Tue, 04 Dec 2018 02:56:24 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=KjRFaaZJ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726228AbeLDKzY (ORCPT + 99 others); Tue, 4 Dec 2018 05:55:24 -0500 Received: from mail.kernel.org ([198.145.29.99]:38152 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725802AbeLDKzW (ORCPT ); Tue, 4 Dec 2018 05:55:22 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 44A672087F; Tue, 4 Dec 2018 10:55:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1543920921; bh=DkAtdtudO0aa6Ma62keWaRPouU7AyQECizrjuVFiHX8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KjRFaaZJrYyP3CKGt7Km0MziPshgw+cCh6uccv4XY7EvaWubf9P7qtJAxbzVvuFO2 N42833ZRoGWoJIRYKG/UIC8v8I8At7475SpdoP/OvJKa6HPBiM2cRPofN+mECgrE+k ZGT7TuYXAVV+6RusL4pej7JB8OSc68t/wFmsLIsA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Dumazet , Paolo Abeni , Willem de Bruijn , Eric Dumazet , "David S. Miller" Subject: [PATCH 4.19 012/139] net: dont keep lonely packets forever in the gro hash Date: Tue, 4 Dec 2018 11:48:13 +0100 Message-Id: <20181204103650.493272051@linuxfoundation.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181204103649.950154335@linuxfoundation.org> References: <20181204103649.950154335@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Paolo Abeni [ Upstream commit 605108acfe6233b72e2f803aa1cb59a2af3001ca ] 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 Fixes: 3b47d30396ba ("net: gro: add a per device gro flush timer") Signed-off-by: Paolo Abeni Acked-by: Willem de Bruijn Acked-by: Eric Dumazet Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/core/dev.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) --- a/net/core/dev.c +++ b/net/core/dev.c @@ -5945,11 +5945,14 @@ bool napi_complete_done(struct napi_stru 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 */