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 v2 1/4] mptcp: update __mptcp_push_pending
Date: Thu, 29 Sep 2022 17:44:29 -0700 (PDT) [thread overview]
Message-ID: <e35178d8-1f2e-c50e-293e-bec8a9bddaf3@linux.intel.com> (raw)
In-Reply-To: <67d506626dfb793b3fc14380f1aff35e67fc6397.1664463491.git.geliang.tang@suse.com>
On Thu, 29 Sep 2022, Geliang Tang wrote:
> To support redundant package schedulers more easily, this patch moves the
> packet scheduler out of the dfrags loop in __mptcp_push_pending(), invoke
> mptcp_sched_get_send() only once. And update the socket locks
> correspondingly.
>
> Signed-off-by: Geliang Tang <geliang.tang@suse.com>
> ---
> net/mptcp/protocol.c | 50 ++++++++++++++++++--------------------------
> 1 file changed, 20 insertions(+), 30 deletions(-)
>
> diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
> index 7ca21915b3d1..37a252a3f05b 100644
> --- a/net/mptcp/protocol.c
> +++ b/net/mptcp/protocol.c
> @@ -1417,14 +1417,6 @@ struct sock *mptcp_subflow_get_send(struct mptcp_sock *msk)
> u64 linger_time;
> long tout = 0;
>
> - /* re-use last subflow, if the burst allow that */
> - if (msk->last_snd && msk->snd_burst > 0 &&
> - sk_stream_memory_free(msk->last_snd) &&
> - mptcp_subflow_active(mptcp_subflow_ctx(msk->last_snd))) {
> - mptcp_set_timeout(sk);
> - return msk->last_snd;
> - }
> -
With msk->last_snd not used here any more, it seems like it can be
removed.
> /* pick the subflow with the lower wmem/wspace ratio */
> for (i = 0; i < SSK_MODE_MAX; ++i) {
> send_info[i].ssk = NULL;
> @@ -1530,15 +1522,21 @@ void mptcp_check_and_set_pending(struct sock *sk)
>
> void __mptcp_push_pending(struct sock *sk, unsigned int flags)
> {
> - struct sock *prev_ssk = NULL, *ssk = NULL;
> struct mptcp_sock *msk = mptcp_sk(sk);
> struct mptcp_sendmsg_info info = {
> .flags = flags,
> };
> bool do_check_data_fin = false;
> struct mptcp_data_frag *dfrag;
> + struct sock *ssk;
> int len;
>
> + ssk = mptcp_sched_get_send(msk);
> + if (!ssk)
> + goto out;
> +
> + lock_sock(ssk);
> +
> while ((dfrag = mptcp_send_head(sk))) {
> info.sent = dfrag->already_sent;
> info.limit = dfrag->data_len;
> @@ -1546,24 +1544,6 @@ void __mptcp_push_pending(struct sock *sk, unsigned int flags)
> while (len > 0) {
> int ret = 0;
>
> - prev_ssk = ssk;
> - ssk = mptcp_sched_get_send(msk);
> -
> - /* First check. If the ssk has changed since
> - * the last round, release prev_ssk
> - */
> - if (ssk != prev_ssk && prev_ssk)
> - mptcp_push_release(prev_ssk, &info);
> - if (!ssk)
> - goto out;
> -
> - /* Need to lock the new subflow only if different
> - * from the previous one, otherwise we are still
> - * helding the relevant lock
> - */
> - if (ssk != prev_ssk)
> - lock_sock(ssk);
> -
> ret = mptcp_sendmsg_frag(sk, ssk, dfrag, &info);
> if (ret <= 0) {
> if (ret == -EAGAIN)
> @@ -1579,11 +1559,21 @@ void __mptcp_push_pending(struct sock *sk, unsigned int flags)
> 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;
> + }
> }
>
> - /* at this point we held the socket lock for the last subflow we used */
> - if (ssk)
> - mptcp_push_release(ssk, &info);
> + if (do_check_data_fin) {
> + tcp_push(ssk, 0, info.mss_now, tcp_sk(ssk)->nonagle,
> + info.size_goal);
> + }
> + release_sock(ssk);
>
> out:
> /* ensure the rtx timer is running */
> --
> 2.35.3
>
>
>
--
Mat Martineau
Intel
next prev parent reply other threads:[~2022-09-30 0:44 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-29 15:03 [PATCH mptcp-next v2 0/4] refactor push pending Geliang Tang
2022-09-29 15:03 ` [PATCH mptcp-next v2 1/4] mptcp: update __mptcp_push_pending Geliang Tang
2022-09-30 0:44 ` Mat Martineau [this message]
2022-09-29 15:03 ` [PATCH mptcp-next v2 2/4] mptcp: add do_push_pending helper Geliang Tang
2022-09-30 0:46 ` Mat Martineau
2022-09-29 15:03 ` [PATCH mptcp-next v2 3/4] mptcp: update __mptcp_subflow_push_pending Geliang Tang
2022-09-29 15:03 ` [PATCH mptcp-next v2 4/4] mptcp: simplify __mptcp_subflow_push_pending Geliang Tang
2022-10-06 17:46 ` 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=e35178d8-1f2e-c50e-293e-bec8a9bddaf3@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