Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp781339ybl; Wed, 11 Dec 2019 07:25:48 -0800 (PST) X-Google-Smtp-Source: APXvYqwIxpp306NKn74T9aeNgOkdiJfPsLamFO6ti9J89msvyhDVlS2iS7hj8hd5uL7F4LgotWt6 X-Received: by 2002:aca:d507:: with SMTP id m7mr3071171oig.48.1576077948754; Wed, 11 Dec 2019 07:25:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576077948; cv=none; d=google.com; s=arc-20160816; b=pdUGhgsIcupXHeCeygsgWSpL6X+GM+L95A95TAxsN2tH9P7vo5GQuPCsG6AaaYMJ+Z Fdp83EiFgsvOa9fRQwdXW7JipPw4gj65lgcV87UVei2CFHoBE6H4hqcQcxlQy5G6GiK9 stjmFCEC9tUu6LCQAVlDcgtNYiAjkq18sDtQyQMxijYVgqlct2vD/mcuSWRiLPN5b7sY iLrM2vK7KiS9zZLdrRkblvMInIZHMfEO5NoeZxxromwF6ggyGQlXqR4euEKPOgrsSnBw 0in8vO1fLkABgtQKgPH0GhQLS2hFmQ5kyvvRRyGtKuLlg+rGVfOE3JAeURQtn2TLMM/Y RBmQ== 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=Bv7gvNEQZ+v/6+930hwYsTsf5qL5e5uKeLlpGVu3nHU=; b=Dr/ZxhAIg9sRxvJR2HkVqj8SrRTYqho5qUlj+/5hbW8Nqe4QcySKjAycf1WBIlTuoS YhwSyA4OZuebuBKMhAHnXrxAzJZXUL/AHsx+Ssp7ibzwqO6tX0NWlMnQHlXGyPhtxeDq NBdX3nsw0+/l4VEhxKo/uSlSVM7ru7G0b/7YeSViLg8XO0xMaP9Tl6gRJ9kx8QjiHBF9 Qs5apP6OUWVEu/XCyzGKcNnvHdYhbNHuGS9G+J++b7xcwYJJpZwH6pcVOaJpvs9ohQFE YfZWh10k4qyGAZKUkx9nE5MLIW/cCw+bjJyoOrayKdYs4e9bYUIgRsWkT8E1ItYMenqI pTuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=mnoiHWbI; 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 l131si1334582oig.120.2019.12.11.07.25.36; Wed, 11 Dec 2019 07:25:48 -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=mnoiHWbI; 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 S1732783AbfLKPYB (ORCPT + 99 others); Wed, 11 Dec 2019 10:24:01 -0500 Received: from mail.kernel.org ([198.145.29.99]:55136 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732420AbfLKPX4 (ORCPT ); Wed, 11 Dec 2019 10:23:56 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.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 D73A42077B; Wed, 11 Dec 2019 15:23:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576077836; bh=03Nh+NVS2P8g7+6KLFx/BlAGRm0adVFqyvzFBF/ZCaM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mnoiHWbIuHOwfO2HdaER92CO44znXNosQZdYuqWg2UWwnc3W1W4W+8dAz/iCAsP6Y JdUY/btaN7URUeu9ybEDOvJ/o3e1qt0rw50Z2QyRg0ar2/d6VOcqZcOOfiyLzB8siY VBWPISwzMcexe05x1EY1mP5vMrvJVgmo4UZipqXI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jean-Louis Dupond , Eric Dumazet , Neal Cardwell , Yuchung Cheng , "David S. Miller" , Sasha Levin Subject: [PATCH 4.19 152/243] tcp: make tcp_space() aware of socket backlog Date: Wed, 11 Dec 2019 16:05:14 +0100 Message-Id: <20191211150349.433232970@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191211150339.185439726@linuxfoundation.org> References: <20191211150339.185439726@linuxfoundation.org> User-Agent: quilt/0.66 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 From: Eric Dumazet [ Upstream commit 85bdf7db5b53cdcc7a901db12bcb3d0063e3866d ] Jean-Louis Dupond reported poor iscsi TCP receive performance that we tracked to backlog drops. Apparently we fail to send window updates reflecting the fact that we are under stress. Note that we might lack a proper window increase when backlog is fully processed, since __release_sock() clears sk->sk_backlog.len _after_ all skbs have been processed. This should not matter in practice. If we had a significant load through socket backlog, we are in a dangerous situation. Reported-by: Jean-Louis Dupond Signed-off-by: Eric Dumazet Acked-by: Neal Cardwell Acked-by: Yuchung Cheng Tested-by: Jean-Louis Dupond Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- include/net/tcp.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/net/tcp.h b/include/net/tcp.h index abcf53a6db045..3f4223a550d92 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -1353,7 +1353,7 @@ static inline int tcp_win_from_space(const struct sock *sk, int space) /* Note: caller must be prepared to deal with negative returns */ static inline int tcp_space(const struct sock *sk) { - return tcp_win_from_space(sk, sk->sk_rcvbuf - + return tcp_win_from_space(sk, sk->sk_rcvbuf - sk->sk_backlog.len - atomic_read(&sk->sk_rmem_alloc)); } -- 2.20.1