Article View: linux.kernel.netdev
Article #19036Re: [PATCH net 3/3] mptcp: exclude MSG_PEEK from receive buffer autotuning
From: Eric Dumazet
Date: Thu, 19 Nov 2026 07:59
Date: Thu, 19 Nov 2026 07:59
52 lines
10900 bytes
10900 bytes
Le mar. 17 nov. 2026 ร 06:22, lei lei <llleigoing@outlook.com> a รฉcrit :
>
> __mptcp_recvmsg_mskq() passes bytes copied by MSG_PEEK to
> mptcp_rcv_space_adjust(), although those bytes remain in the receive
> queue. Repeated peeks count the same data as new application
> consumption and can inflate the receive-memory budget. Subtracting the
> unread queue at a measurement boundary cannot undo that repeated count.
>
> The receive path originally skipped this adjustment for MSG_PEEK.
> Commit 581302298524 ("mptcp: error out earlier on disconnect") moved
> the adjustment calls without preserving that check.
>
> Only adjust receive space for non-peeking reads. Keep the returned
> byte count unchanged.
This one looks good to me.
mptcp_rcv_space_adjust() accumulates @copied in msk->rcvq_space.copied,
and mptcp_inq_hint() is subtracted once per measurement, so N peeks
of the same bytes are indeed counted N times.
(TCP also calls tcp_rcv_space_adjust() for MSG_PEEK, but it uses
tp->copied_seq, which is not changed by a peek, so it has no such
issue.)
The Fixes: tag is correct, commit 581302298524 removed the
"if (!(flags & MSG_PEEK))" test.
>
> A loopback test leaves a fixed 32 KiB queue unread and peeks 4096 times.
> Before this change, sk_rcvbuf grows to the configured 8 MiB limit.
> Afterwards, both the budget and the queue remain unchanged, and a
> subsequent consuming read returns the original data intact.
It would be nice to have this test in
tools/testing/selftests/net/mptcp/ (or as a packetdrill test),
MPTCP maintainers can tell you what they prefer.
>
> Fixes: 581302298524 ("mptcp: error out earlier on disconnect")
> Signed-off-by: lllei <llleigoing@outlook.com>
Given my comments on patches 1 and 2, I suggest you send this
patch alone, it does not depend on them.
With the Signed-off-by: fixed:
Reviewed-by: Eric Dumazet <edumazet@kernel.org>
Thanks.
Technical Details
Message-ID:
<CAL4WiioFmJXhfGSY7rs7aR3FA_xC_f0sjuArBo7CBjV_tXTbTw@mail.gmail.com>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-366833-linux-kernel-netdev=dewy.ruReferences:
<20261117052200.1507847-1-llleigoing@outlook.com> <20261117052200.1507847-4-llleigoing@outlook.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-366833-linux-kernel-netdev=dewy.ru
From: edumazet@kernel.org (Eric Dumazet)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net 3/3] mptcp: exclude MSG_PEEK from receive buffer autotuning
Date: Thu, 19 Nov 2026 08:59:01 +0100
Organization: Usenet Network
Message-ID: <CAL4WiioFmJXhfGSY7rs7aR3FA_xC_f0sjuArBo7CBjV_tXTbTw@mail.gmail.com>
References: <20261117052200.1507847-1-llleigoing@outlook.com> <20261117052200.1507847-4-llleigoing@outlook.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Injection-Info: usenet.network;
logging-data="2822703"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:Nf9KOj0X8zjb+a5orS2Dv/3LvHI= sha256:3J47wXP7vRAhA4319vFiw+e4hhougKqDbBSkhWFgmsQ=
sha1:IJvoS0yL/BcwW+nLwQnXLkd0W58= sha256:l/4yljegO8LJ+4PVsECueGr4Ymy+8mjngBfk7gd5DNc=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
by mail.dewy.ru (Postfix) with ESMTP id 2A1BB115557; Thu, 19 Nov 2026 10:59:34 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.401
X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31
tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1,
DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id 4-xYLjm3KOPK;
Thu, 19 Nov 2026 10:59:29 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-366833-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
by mail.dewy.ru (Postfix) with ESMTPS id 8F199115514; Thu, 19 Nov 2026 10:59:20 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
by sea.lore.kernel.org (Postfix) with ESMTP id EEF5F1EA7DD; Thu, 19 Nov 2026 07:59:14 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
t=1795075154;
b=Zwo/1oac1u4vaNE//QbXG9s2mWtDGm40x3kE8YHoDWFwDa7z5rN7+RGaDtC40ollCFA3
1fDolsqWpo5zy0Z9TwiJx6WrB5rR8XNqcbvcrEpGZPvRleRRuFHCvqoaQ78F15PZM4ORt
+92X/3P8/WAwVwKYdD1O0v7mBsgBbt+2G9cMzY84oxawL1cloXe6L94ierOFlWvWkbd1l
WmADMzBOtB2NTbOoWCN5uGgaGGthzZa1+rSQSz/jRZXlSB42aGqwEvSGKhDOjJb72MrqC
oFUv0rCxjbyLU4ddMpDvrxlnXVDmyQ6y0QYzg1Xvc+YEpb0a/WggHMgxVCVRJUciBzg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1795075154;
h=X-Original-To:Received:Received:DKIM-Signature:Received:
X-Gm-Message-State:X-Received:X-Mailing-List:List-Id:List-Post:
List-Help:List-Subscribe:List-Unsubscribe:List-Owner:Precedence:
MIME-Version:References:In-Reply-To:From:Date:
X-Gmail-Original-Message-ID:X-Gm-Features:Message-ID:Subject:To:Cc:
Content-Type:Content-Transfer-Encoding;
bh=JkzZ+/LzqSu9eJ8rN1zudTbo5cBOm4V3ktgf/z3HvLg=;
b=lmh8ovv30U+PK8YwiY7qQhiJcdMJDguKr+5gZqG5xag7Y7WMsW4S9XR8o6uEmHRuf1zW
RJVnlnganLkk7r+xgpkZITnlNKFNUsJeI7xQc3hKe346sjJ/Q75ti/2A2fKYg/job8FXy
QRrJ6bT9tGPIyqEsuRvTmcZ4nMGpcppggYRarchoFJa+n4tRrIcsJlw2n4LefmAqdSzqI
tQRA9ggchBrGATJTEd6FMTro3eNJgf9Gkh34B8I7Yb0jpU7AnqUmvcXnCjIGHXAMGef0r
rUpMeHtCAVKFT1PwakMIyQIeR7YHM50BeeDOwTKWzfan+iedIS+dfF3f3GbSZN15uUg==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org;
dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=cT1d9bAO;
arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 1B00D60A2601;
Thu, 19 Nov 2026 07:59:14 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=cT1d9bAO
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1795075153;
b=rNUB9RQzMUEPZu6PZ2hZV6WQvVco7E7+NyPbCu7iFte5xvFC/QlM0OcHLqFwDpYACwo/
LOVbA4oWGPQMEGComlBmews3cnREV2I64tMnGDO01GhkEw9Tc3/l+esfSBsrsdmd+NUSx
Gl098kyGZiUFfGnp3Hqcyc8s4axds756lo2ED0XmQgzcPRFMvw/4LeYwlZSrvcWgmVkEi
c18g2aN0CGh0Hqif615G+tGLSq6szdrSumflPNqC4HaA2NwPJ/ehdPAb3t2jZarKzWqMu
AjAnAb1fw8N33+k+FOTwR2IsFpDvp+iQHEcgXWtAhy5jC+QHC3lfSnr5wd+BBcndDZQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1795075153;
h=Received:DKIM-Signature:Received:X-Gm-Message-State:X-Received:
MIME-Version:References:In-Reply-To:From:Date:
X-Gmail-Original-Message-ID:X-Gm-Features:Message-ID:Subject:To:Cc:
Content-Type:Content-Transfer-Encoding;
bh=JkzZ+/LzqSu9eJ8rN1zudTbo5cBOm4V3ktgf/z3HvLg=;
b=jblOZs5gRpo1qqzz6ckcKt2F+y9iBefpS211d5M7mdfOKWdQJrRbNmNpLYogTdAaIV8g
FDN0JS+LllpSKxTrW7Zn6Gb7FdS+OgCJIdJY2qHXhNkhKOYwS6uDIF6Ys+h8LtV6j39wv
fuJrVBXLl2eZ9HJWZpn7OPi5oy0lXTfkvgGq9WOLq7+dr+A5X81qnwzfL/DXDqFORCpwJ
T1GPPfS16r11HDgFWsKurEMiNTyTx+1w/KmCS1YBQ/udNa2B7C3Y9ruuf2di9OGRIgW15
vbpWX1FQi8ui7ZRDyQWkxH8lAcJFlx67nyCQwkXj3ssaAyEuhgk+KBiIKh85VBnfjMw==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org;
dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=cT1d9bAO;
arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature ECDSA (prime256v1))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3C202606A32A
for <netdev@vger.kernel.org>; Thu, 19 Nov 2026 07:59:13 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id C915F1F000D3
for <netdev@vger.kernel.org>; Thu, 19 Nov 2026 07:59:12 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
s=k20260515; t=1795075152;
bh=JkzZ+/LzqSu9eJ8rN1zudTbo5cBOm4V3ktgf/z3HvLg=;
h=References:In-Reply-To:From:Date:Subject:To:Cc;
b=cT1d9bAOKHMxpj+whA++2fdRttofOMvSLcKHSEOdyt/Fgip0BdEiPrxLporpSGVw4
0AdIjQum156h4D3EPbGFu+GTMNX7BE0wjF2P4XJ0J1Wx7MZY9iGOwroeTTXB5jl4uC
Df+G39DGeSU7CH2a9nwL3o1x1uEvD/yc5pcCHnxn35tPb2LuwH9GNJ4IVS7Ag7j8hs
7+XGxVYAF+JA+7YgHGzxInzEmdljCH2+XVgPoU54miYoeCphdtlUBPELRsJu3DdFQD
ZOZpFc46llKHhS7PI+9lncIKoiUJleIhZY/OuKFl6YJKLYZSnf9FVFzSxxzFS/uOoF
2IO4NYosvTDEg==
X-Received: by mail-oo1-f48.google.com with SMTP id 006d021491bc7-71ac798b8bbso1219877eaf.1
for <netdev@vger.kernel.org>; Wed, 18 Nov 2026 23:59:12 -0800 (PST)
X-Gm-Message-State: APuU4Z+Xp1k0yS8GFC08G/KIB9l68teOYWIrPLE0QYEfTxZniYBPcDXH
OUmBEkrVzBY58uee8exl3YOzaSiTQD8Xc5cR4ayEh77nMjoCzA+OISUFeYH1FJ3liSFLx7IEwAh
cY3eqw0noLDZoCItbpoHm3RTwkoXXDwI=
X-Received: by 2002:a05:6820:1517:b0:716:d827:9ecb with SMTP id
006d021491bc7-71b1842dcd8mr3683424eaf.30.1795075152056; Wed, 18 Nov 2026
23:59:12 -0800 (PST)
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list
X-In-Reply-To: <20261117052200.1507847-4-llleigoing@outlook.com>
X-Gmail-Original-Message-ID: <CAL4WiioFmJXhfGSY7rs7aR3FA_xC_f0sjuArBo7CBjV_tXTbTw@mail.gmail.com>
X-Gm-Features: AclHuK8OqGGNm4LBhCnEZgVIY5TwLI8xRaYoD8FYFVRWho5XxXLqAQY5a9U59Mw
X-Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>, "mptcp@lists.linux.dev" <mptcp@lists.linux.dev>,
"ncardwell@google.com" <ncardwell@google.com>, "kuniyu@google.com" <kuniyu@google.com>,
"davem@davemloft.net" <davem@davemloft.net>, "kuba@kernel.org" <kuba@kernel.org>,
"pabeni@redhat.com" <pabeni@redhat.com>, "horms@kernel.org" <horms@kernel.org>,
"matttbe@kernel.org" <matttbe@kernel.org>, "martineau@kernel.org" <martineau@kernel.org>,
"geliang@kernel.org" <geliang@kernel.org>