From: Paolo Abeni <pabeni@redhat.com>
To: mptcp@lists.linux.dev, "Matthieu Baerts (NGI0)" <matttbe@kernel.org>
Subject: Re: [PATCH v2 mptcp-next 7/7] mptcp: implemented OoO queue pruning
Date: Thu, 6 Aug 2026 18:42:50 +0200 [thread overview]
Message-ID: <80572775-6e76-4c79-83e2-efdedbd3f3b8@redhat.com> (raw)
In-Reply-To: <be9dcbef291a424fdd54d19fc72f9f28fb239b81.1786026372.git.pabeni@redhat.com>
On 8/6/26 4:45 PM, Paolo Abeni wrote:
> When moving incoming skbs in the msk receive queue and the latter
> is above limits, prune it as needed quite alike what TCP is doing
> at the subflow level. The main difference relies in the stop condition:
> since MPTCP does not perform collapsing, it's better off dropping the
> bare minimum to fit the (newer) incoming packet.
>
> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
> Tested-by: Gang Yan <yangang@kylinos.cn>
> Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
> ---
> v<n> -> v<n+1>:
> - prune only for new data
> - reorganize the code to follow more closely TCP
> ---
> net/mptcp/mib.c | 1 +
> net/mptcp/mib.h | 1 +
> net/mptcp/protocol.c | 81 ++++++++++++++++++++++++++++++++++++++------
> 3 files changed, 73 insertions(+), 10 deletions(-)
>
> diff --git a/net/mptcp/mib.c b/net/mptcp/mib.c
> index ef65e2df709f..2569385bab7c 100644
> --- a/net/mptcp/mib.c
> +++ b/net/mptcp/mib.c
> @@ -87,6 +87,7 @@ static const struct snmp_mib mptcp_snmp_list[] = {
> SNMP_MIB_ITEM("WinProbe", MPTCP_MIB_WINPROBE),
> SNMP_MIB_ITEM("BacklogDrop", MPTCP_MIB_BACKLOGDROP),
> SNMP_MIB_ITEM("RcvPruned", MPTCP_MIB_RCVPRUNED),
> + SNMP_MIB_ITEM("OFOPruned", MPTCP_MIB_OFOPRUNED),
> };
>
> /* mptcp_mib_alloc - allocate percpu mib counters
> diff --git a/net/mptcp/mib.h b/net/mptcp/mib.h
> index 9271205f682e..3a3425e258a7 100644
> --- a/net/mptcp/mib.h
> +++ b/net/mptcp/mib.h
> @@ -90,6 +90,7 @@ enum linux_mptcp_mib_field {
> MPTCP_MIB_WINPROBE, /* MPTCP-level zero window probe */
> MPTCP_MIB_BACKLOGDROP, /* Backlog over memory limit */
> MPTCP_MIB_RCVPRUNED, /* Dropped due to memory constraints */
> + MPTCP_MIB_OFOPRUNED, /* MPTCP-level OoO queue pruned */
> __MPTCP_MIB_MAX
> };
>
> diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
> index 63f2c18bc01f..ec874d2ead6a 100644
> --- a/net/mptcp/protocol.c
> +++ b/net/mptcp/protocol.c
> @@ -242,6 +242,65 @@ static bool mptcp_rcvbuf_grow(struct sock *sk, u32 newval)
> return false;
> }
>
> +/* "Inspired" from the TCP version; main difference: stop as soon as the MPTCP
> + * socket is under memory limit.
> + */
> +static void mptcp_prune_ofo_queue(struct sock *sk,
> + const struct sk_buff *in_skb)
> +{
> + struct mptcp_sock *msk = mptcp_sk(sk);
> + struct rb_node *node, *prev;
> + bool pruned = false;
> + u64 mem;
> +
> + if (RB_EMPTY_ROOT(&msk->out_of_order_queue))
> + return;
> +
> + node = &msk->ooo_last_skb->rbnode;
> +
> + do {
> + struct sk_buff *skb = rb_to_skb(node);
> +
> + /* Stop pruning if the incoming skb would land in OoO tail. */
> + if (after64(MPTCP_SKB_CB(in_skb)->map_seq,
> + MPTCP_SKB_CB(skb)->map_seq))
> + break;
> +
> + pruned = true;
> + prev = rb_prev(node);
> + rb_erase(node, &msk->out_of_order_queue);
> + mptcp_drop(sk, skb);
> + msk->ooo_last_skb = rb_to_skb(prev);
> +
> + mem = (unsigned int)sk_rmem_alloc_get(sk);
> + if (mem <= sk->sk_rcvbuf)
> + break;
> +
> + node = prev;
> + } while (node);
> +
> + if (pruned)
> + MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_OFOPRUNED);
> +}
> +
> +/* The stack can't drop packets for fallback socket at the msk level, or the
> + * stream will break.
> + */
> +static bool mptcp_can_ingest(const struct sock *sk)
> +{
> + return unlikely(sk_rmem_alloc_get(sk) <= READ_ONCE(sk->sk_rcvbuf)) ||
> + __mptcp_check_fallback(mptcp_sk(sk));
The above should obviously be: 'likely(...)'
@Matttbe: please LMK if you prefer a repost or you could adjust that
while applying to the export branch.
/P
next prev parent reply other threads:[~2026-08-06 16:43 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-06 14:45 [PATCH v2 mptcp-next 0/7] mptcp: address stall under memory pressure Paolo Abeni
2026-08-06 14:45 ` [PATCH v2 mptcp-next 1/7] mptcp: move the retrans loop to a separate helper Paolo Abeni
2026-08-06 14:45 ` [PATCH v2 mptcp-next 2/7] mptcp: move the stale logic out of retrans scheduler Paolo Abeni
2026-08-06 16:41 ` Paolo Abeni
2026-08-06 16:45 ` Matthieu Baerts
2026-08-06 14:45 ` [PATCH v2 mptcp-next 3/7] mptcp: let the retrans scheduler do its job Paolo Abeni
2026-08-06 14:45 ` [PATCH v2 mptcp-next 4/7] mptcp: explicitly drop over memory limits Paolo Abeni
2026-08-06 14:45 ` [PATCH v2 mptcp-next 5/7] mptcp: enforce hard limit on backlog flushing Paolo Abeni
2026-08-06 14:45 ` [PATCH v2 mptcp-next 6/7] mptcp: avoid code duplication in __mptcp_move_skb() Paolo Abeni
2026-08-06 14:45 ` [PATCH v2 mptcp-next 7/7] mptcp: implemented OoO queue pruning Paolo Abeni
2026-08-06 16:42 ` Paolo Abeni [this message]
2026-08-06 16:46 ` Matthieu Baerts
2026-08-08 2:31 ` Geliang Tang
2026-08-08 16:34 ` Matthieu Baerts
2026-08-10 10:47 ` Paolo Abeni
2026-08-07 11:45 ` [PATCH v2 mptcp-next 0/7] mptcp: address stall under memory pressure Matthieu Baerts
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=80572775-6e76-4c79-83e2-efdedbd3f3b8@redhat.com \
--to=pabeni@redhat.com \
--cc=matttbe@kernel.org \
--cc=mptcp@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox