MPTCP Linux Development
 help / color / mirror / Atom feed
From: Mat Martineau <martineau@kernel.org>
To: Matthieu Baerts <matttbe@kernel.org>
Cc: Paolo Abeni <pabeni@redhat.com>,
	Geliang Tang <geliang@kernel.org>,
	 mptcp@lists.linux.dev
Subject: Re: [PATCH v6 mptcp-next 11/11] mptcp: leverage the backlog for RX packet processing
Date: Thu, 23 Oct 2025 10:02:23 -0700 (PDT)	[thread overview]
Message-ID: <4d70359f-20bb-4575-b6c5-8e862c2547e3@kernel.org> (raw)
In-Reply-To: <34f90baa-72ff-4c00-917a-a0d65ff0e608@kernel.org>

On Thu, 23 Oct 2025, Matthieu Baerts wrote:

> Hi Paolo, Mat,
>
> On 23/10/2025 17:11, Paolo Abeni wrote:
>>
>>
>> On 10/22/25 4:31 PM, Paolo Abeni wrote:
>>> When the msk socket is owned or the msk receive buffer is full,
>>> move the incoming skbs in a msk level backlog list. This avoid
>>> traversing the joined subflows and acquiring the subflow level
>>> socket lock at reception time, improving the RX performances.
>>>
>>> When processing the backlog, use the fwd alloc memory borrowed from
>>> the incoming subflow. skbs exceeding the msk receive space are
>>> not dropped; instead they are kept into the backlog until the receive
>>> buffer is freed. Dropping packets already acked at the TCP level is
>>> explicitly discouraged by the RFC and would corrupt the data stream
>>> for fallback sockets.
>>>
>>> Move the conditional reschedule in release_cb() to take action only
>>> after the first loop iteration, to avoid rescheduling just before
>>> releasing the lock.
>>>
>>> Special care is needed to avoid adding skbs to the backlog of a closed
>>> msk and to avoid leaving dangling references into the backlog
>>> at subflow closing time.
>
> (...)
>
>>> diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
>>> index 5a1d8f9e0fb0ec..0aae17ab77edb2 100644
>>> --- a/net/mptcp/protocol.c
>>> +++ b/net/mptcp/protocol.c
>
> (...)
>
>>> -static bool __mptcp_move_skbs(struct sock *sk)
>>> +static bool mptcp_can_spool_backlog(struct sock *sk, u32 moved,
>>> +				    struct list_head *skbs)
>>>  {
>>> -	struct mptcp_subflow_context *subflow;
>>>  	struct mptcp_sock *msk = mptcp_sk(sk);
>>> -	bool ret = false;
>>>
>>> -	if (list_empty(&msk->conn_list))
>>> +	if (list_empty(&msk->backlog_list))
>>>  		return false;
>>>
>>> -	subflow = list_first_entry(&msk->conn_list,
>>> -				   struct mptcp_subflow_context, node);
>>> -	for (;;) {
>>> -		struct sock *ssk;
>>> -		bool slowpath;
>>> +	/* Borrowed mem could be zero only in the unlikely event that the bl
>>> +	 * is full
>>> +	 */
>>> +	if (likely(msk->borrowed_mem)) {
>>> +		sk_forward_alloc_add(sk, msk->borrowed_mem);
>>> +		msk->borrowed_mem = 0;
>>> +		sk->sk_reserved_mem = msk->backlog_len;
>>
>> With the above I intended to prevent the fwd memory handling from
>> releasing backlog_len bytes. Re-reading the relevant code, it does not
>> allow that (experimentation confirmed), see:
>>
>> https://elixir.bootlin.com/linux/v6.18-rc2/source/include/net/sock.h#L1593
>>
>> and:
>>
>> https://elixir.bootlin.com/linux/v6.18-rc2/source/include/net/sock.h#L1580
>>
>> This will need some more care. Also patch 2 will require some
>> significant rework.
>
> Thank you for looking at this complex part, and for having spot that!
>
>> @Mat, @Matttbe: could you please consider merging patches 1,3-9?
>>
>> I think they should be pretty uncontroversial, would make the series
>> more manegeable for future iterations (and would alleviate my
>> frustration to make this thing work correctly).
>
> It makes sense, fine by me. I will wait for Mat's review before applying
> them (patch 1 is for 'net' I suppose).
>

Applying 1,3-9 to our tree(s) makes sense to me. Maybe patch 5 to -net 
too? (just sent email about that before I saw this message).

Matthieu do you want me to reply to each so the RvB tag is in patchwork, 
or does this suffice for patches 1 & 3-9:

Reviewed-by: Mat Martineau <martineau@kernel.org>

- Mat


  reply	other threads:[~2025-10-23 17:02 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-22 14:31 [PATCH v6 mptcp-next 00/11] mptcp: introduce backlog processing Paolo Abeni
2025-10-22 14:31 ` [PATCH v6 mptcp-next 01/11] mptcp: drop bogus optimization in __mptcp_check_push() Paolo Abeni
2025-10-22 14:31 ` [PATCH v6 mptcp-next 02/11] mptcp: borrow forward memory from subflow Paolo Abeni
2025-10-23  6:38   ` Geliang Tang
2025-10-22 14:31 ` [PATCH v6 mptcp-next 03/11] mptcp: cleanup fallback data fin reception Paolo Abeni
2025-10-22 14:31 ` [PATCH v6 mptcp-next 04/11] mptcp: cleanup fallback dummy mapping generation Paolo Abeni
2025-10-22 14:31 ` [PATCH v6 mptcp-next 05/11] mptcp: fix MSG_PEEK stream corruption Paolo Abeni
2025-10-23 16:56   ` Mat Martineau
2025-10-24  7:34     ` Paolo Abeni
2025-10-22 14:31 ` [PATCH v6 mptcp-next 06/11] mptcp: ensure the kernel PM does not take action too late Paolo Abeni
2025-10-22 14:31 ` [PATCH v6 mptcp-next 07/11] mptcp: do not miss early first subflow close event notification Paolo Abeni
2025-10-22 14:31 ` [PATCH v6 mptcp-next 08/11] mptcp: make mptcp_destroy_common() static Paolo Abeni
2025-10-22 14:31 ` [PATCH v6 mptcp-next 09/11] mptcp: drop the __mptcp_data_ready() helper Paolo Abeni
2025-10-23  6:38   ` Geliang Tang
2025-10-22 14:31 ` [PATCH v6 mptcp-next 10/11] mptcp: introduce mptcp-level backlog Paolo Abeni
2025-10-22 14:31 ` [PATCH v6 mptcp-next 11/11] mptcp: leverage the backlog for RX packet processing Paolo Abeni
2025-10-23 15:11   ` Paolo Abeni
2025-10-23 15:52     ` Matthieu Baerts
2025-10-23 17:02       ` Mat Martineau [this message]
2025-10-23 17:43         ` Matthieu Baerts
2025-10-22 15:50 ` [PATCH v6 mptcp-next 00/11] mptcp: introduce backlog processing MPTCP CI
2025-10-23  6:37 ` Geliang Tang
2025-10-27 12:17 ` 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=4d70359f-20bb-4575-b6c5-8e862c2547e3@kernel.org \
    --to=martineau@kernel.org \
    --cc=geliang@kernel.org \
    --cc=matttbe@kernel.org \
    --cc=mptcp@lists.linux.dev \
    --cc=pabeni@redhat.com \
    /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