From: Matthieu Baerts <matttbe@kernel.org>
To: Geliang Tang <geliang@kernel.org>, mptcp@lists.linux.dev
Cc: Geliang Tang <tanggeliang@kylinos.cn>
Subject: Re: [PATCH mptcp-next v3 1/3] mptcp: remove duplicate sk_reset_timer call
Date: Wed, 6 Aug 2025 17:31:19 +0200 [thread overview]
Message-ID: <e6124c20-78cd-46d5-94e4-8afb54c319f3@kernel.org> (raw)
In-Reply-To: <f9f437aeb4bfd2ea461045c932c836ffea96227b.1754449947.git.tanggeliang@kylinos.cn>
Hi Geliang,
On 06/08/2025 05:17, Geliang Tang wrote:
> From: Geliang Tang <tanggeliang@kylinos.cn>
>
> sk_reset_timer() was called twice in mptcp_pm_alloc_anno_list. Simplify the
> code by using a 'goto' statement to eliminate the duplication.
>
> Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
> ---
> net/mptcp/pm.c | 8 +++-----
> 1 file changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/net/mptcp/pm.c b/net/mptcp/pm.c
> index 5dec018fdda2..1330af6a2154 100644
> --- a/net/mptcp/pm.c
> +++ b/net/mptcp/pm.c
> @@ -348,7 +348,6 @@ bool mptcp_pm_alloc_anno_list(struct mptcp_sock *msk,
> {
> struct mptcp_pm_add_entry *add_entry = NULL;
> struct sock *sk = (struct sock *)msk;
> - struct net *net = sock_net(sk);
>
> lockdep_assert_held(&msk->pm.lock);
>
> @@ -358,9 +357,7 @@ bool mptcp_pm_alloc_anno_list(struct mptcp_sock *msk,
> if (WARN_ON_ONCE(mptcp_pm_is_kernel(msk)))
> return false;
>
> - sk_reset_timer(sk, &add_entry->add_timer,
> - jiffies + mptcp_get_add_addr_timeout(net));
> - return true;
> + goto out;
Good idea, but maybe better to have a more explicit label, e.g. reset_timer.
> }
>
> add_entry = kmalloc(sizeof(*add_entry), GFP_ATOMIC);
> @@ -374,8 +371,9 @@ bool mptcp_pm_alloc_anno_list(struct mptcp_sock *msk,
> add_entry->retrans_times = 0;
>
> timer_setup(&add_entry->add_timer, mptcp_pm_add_timer, 0);
> +out:
> sk_reset_timer(sk, &add_entry->add_timer,
> - jiffies + mptcp_get_add_addr_timeout(net));
> + jiffies + mptcp_get_add_addr_timeout(sock_net(sk)));
>
> return true;
> }
Cheers,
Matt
--
Sponsored by the NGI0 Core fund.
next prev parent reply other threads:[~2025-08-06 15:31 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-06 3:17 [PATCH mptcp-next v3 0/3] mptcp: improve ADD_ADDR timeout handling Geliang Tang
2025-08-06 3:17 ` [PATCH mptcp-next v3 1/3] mptcp: remove duplicate sk_reset_timer call Geliang Tang
2025-08-06 15:31 ` Matthieu Baerts [this message]
2025-08-06 3:17 ` [PATCH mptcp-next v3 2/3] mptcp: make ADD_ADDR retransmission timeout adaptive Geliang Tang
2025-08-06 15:34 ` Matthieu Baerts
2025-08-07 3:25 ` Geliang Tang
2025-08-07 11:56 ` Matthieu Baerts
2025-08-10 1:13 ` Geliang Tang
2025-08-11 14:51 ` Matthieu Baerts
2025-08-11 15:34 ` Christoph Paasch
2025-08-12 8:33 ` Geliang Tang
2025-08-12 8:39 ` Matthieu Baerts
2025-08-12 9:20 ` Geliang Tang
2025-08-12 9:32 ` Matthieu Baerts
2025-08-06 3:17 ` [PATCH mptcp-next v3 3/3] selftests: mptcp: remove add_addr_timeout settings Geliang Tang
2025-08-06 15:29 ` [PATCH mptcp-next v3 0/3] mptcp: improve ADD_ADDR timeout handling MPTCP CI
2025-08-06 15:36 ` Matthieu Baerts
2025-08-07 5:51 ` Geliang Tang
2025-08-07 11:56 ` 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=e6124c20-78cd-46d5-94e4-8afb54c319f3@kernel.org \
--to=matttbe@kernel.org \
--cc=geliang@kernel.org \
--cc=mptcp@lists.linux.dev \
--cc=tanggeliang@kylinos.cn \
/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;
as well as URLs for NNTP newsgroup(s).