MPTCP Linux Development
 help / color / mirror / Atom feed
From: Mat Martineau <mathew.j.martineau@linux.intel.com>
To: Geliang Tang <geliang.tang@suse.com>
Cc: mptcp@lists.linux.dev
Subject: Re: [PATCH mptcp-next v3 4/5] mptcp: update __mptcp_subflow_push_pending
Date: Fri, 30 Sep 2022 17:16:04 -0700 (PDT)	[thread overview]
Message-ID: <6e1884f7-54f4-4cae-67c0-53c66f2dfb79@linux.intel.com> (raw)
In-Reply-To: <37356025b64f3a1efc6e2726a51840c4fb80a177.1664547250.git.geliang.tang@suse.com>

On Fri, 30 Sep 2022, Geliang Tang wrote:

> Move the packet scheduler out of the dfrags loop, invoke it only once in
> __mptcp_subflow_push_pending().
>
> Signed-off-by: Geliang Tang <geliang.tang@suse.com>

Hi Geliang -

I think the __mptcp_push_pending() changes are looking good. Some changes 
are needed here for __mptcp_subflow_push_pending().

> ---
> net/mptcp/protocol.c | 44 ++++++++++++++++++++------------------------
> 1 file changed, 20 insertions(+), 24 deletions(-)
>
> diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
> index dc5e03a616b3..8e67c149bbab 100644
> --- a/net/mptcp/protocol.c
> +++ b/net/mptcp/protocol.c
> @@ -1589,7 +1589,15 @@ static void __mptcp_subflow_push_pending(struct sock *sk, struct sock *ssk)
> 	struct mptcp_data_frag *dfrag;
> 	struct sock *xmit_ssk;
> 	int len, copied = 0;
> -	bool first = true;
> +
> +	xmit_ssk = mptcp_sched_get_send(msk);
> +	if (!xmit_ssk)
> +		goto out;
> +	if (xmit_ssk != ssk) {
> +		mptcp_subflow_delegate(mptcp_subflow_ctx(xmit_ssk),
> +				       MPTCP_DELEGATE_SEND);
> +		goto out;
> +	}

There's no need to delegate before the first __do_push_pending(). In the 
existing code, the first send skips the scheduler call and tries to send 
on the selected ssk (the one that's the last arg to the function).

The existing code then calls the scheduler after each 
mptcp_sendmsg_frag(), and if the scheduler chooses a different xmit_ssk 
then mptcp_subflow_delegate() is called and it does the 'goto out'.

In other words, this function also needs a loop like 
__mptcp_push_pending() to call the scheduler multiple times.


- Mat

>
> 	info.flags = 0;
> 	while ((dfrag = mptcp_send_head(sk))) {
> @@ -1599,19 +1607,6 @@ static void __mptcp_subflow_push_pending(struct sock *sk, struct sock *ssk)
> 		while (len > 0) {
> 			int ret = 0;
>
> -			/* the caller already invoked the packet scheduler,
> -			 * check for a different subflow usage only after
> -			 * spooling the first chunk of data
> -			 */
> -			xmit_ssk = first ? ssk : mptcp_sched_get_send(msk);
> -			if (!xmit_ssk)
> -				goto out;
> -			if (xmit_ssk != ssk) {
> -				mptcp_subflow_delegate(mptcp_subflow_ctx(xmit_ssk),
> -						       MPTCP_DELEGATE_SEND);
> -				goto out;
> -			}
> -
> 			ret = mptcp_sendmsg_frag(sk, ssk, dfrag, &info);
> 			if (ret <= 0)
> 				goto out;
> @@ -1619,11 +1614,18 @@ static void __mptcp_subflow_push_pending(struct sock *sk, struct sock *ssk)
> 			info.sent += ret;
> 			copied += ret;
> 			len -= ret;
> -			first = false;
>
> 			mptcp_update_post_push(msk, dfrag, ret);
> 		}
> 		WRITE_ONCE(msk->first_pending, mptcp_send_next(sk));
> +
> +		if (msk->snd_burst > 0 &&
> +		    sk_stream_memory_free(ssk) &&
> +		    mptcp_subflow_active(mptcp_subflow_ctx(ssk))) {
> +			mptcp_set_timeout(sk);
> +		} else {
> +			break;
> +		}
> 	}
>
> out:
> @@ -3182,16 +3184,10 @@ void __mptcp_check_push(struct sock *sk, struct sock *ssk)
> 	if (!mptcp_send_head(sk))
> 		return;
>
> -	if (!sock_owned_by_user(sk)) {
> -		struct sock *xmit_ssk = mptcp_sched_get_send(mptcp_sk(sk));
> -
> -		if (xmit_ssk == ssk)
> -			__mptcp_subflow_push_pending(sk, ssk);
> -		else if (xmit_ssk)
> -			mptcp_subflow_delegate(mptcp_subflow_ctx(xmit_ssk), MPTCP_DELEGATE_SEND);
> -	} else {
> +	if (!sock_owned_by_user(sk))
> +		__mptcp_subflow_push_pending(sk, ssk);
> +	else
> 		__set_bit(MPTCP_PUSH_PENDING, &mptcp_sk(sk)->cb_flags);
> -	}
> }
>
> #define MPTCP_FLAGS_PROCESS_CTX_NEED (BIT(MPTCP_PUSH_PENDING) | \
> -- 
> 2.35.3
>
>
>

--
Mat Martineau
Intel

  reply	other threads:[~2022-10-01  0:16 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-30 14:17 [PATCH mptcp-next v3 0/5] refactor push pending Geliang Tang
2022-09-30 14:17 ` [PATCH mptcp-next v3 1/5] mptcp: use msk instead of mptcp_sk(sk) Geliang Tang
2022-09-30 14:17 ` [PATCH mptcp-next v3 2/5] mptcp: update __mptcp_push_pending Geliang Tang
2022-09-30 14:17 ` [PATCH mptcp-next v3 3/5] mptcp: add do_push_pending helper Geliang Tang
2022-09-30 14:17 ` [PATCH mptcp-next v3 4/5] mptcp: update __mptcp_subflow_push_pending Geliang Tang
2022-10-01  0:16   ` Mat Martineau [this message]
2022-09-30 14:17 ` [PATCH mptcp-next v3 5/5] mptcp: simplify __mptcp_subflow_push_pending Geliang Tang
2022-10-06 17:31   ` mptcp: simplify __mptcp_subflow_push_pending: Tests Results MPTCP CI

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=6e1884f7-54f4-4cae-67c0-53c66f2dfb79@linux.intel.com \
    --to=mathew.j.martineau@linux.intel.com \
    --cc=geliang.tang@suse.com \
    --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