diff mbox series

[net] sctp: do not check hb_timer.expires when resetting hb_timer

Message ID d958c06985713ec84049a2d5664879802710179a.1675095933.git.lucien.xin@gmail.com (mailing list archive)
State Accepted
Commit 8f35ae17ef565a605de5f409e04bcd49a55d7646
Delegated to: Netdev Maintainers
Headers show
Series [net] sctp: do not check hb_timer.expires when resetting hb_timer | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net
netdev/fixes_present success Fixes tag present in non-next series
netdev/subject_prefix success Link
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 670 this patch: 670
netdev/cc_maintainers warning 1 maintainers not CCed: vyasevich@gmail.com
netdev/build_clang fail Errors and warnings before: 3 this patch: 3
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn fail Errors and warnings before: 4 this patch: 4
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 10 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Xin Long Jan. 30, 2023, 4:25 p.m. UTC
It tries to avoid the frequently hb_timer refresh in commit ba6f5e33bdbb
("sctp: avoid refreshing heartbeat timer too often"), and it only allows
mod_timer when the new expires is after hb_timer.expires. It means even
a much shorter interval for hb timer gets applied, it will have to wait
until the current hb timer to time out.

In sctp_do_8_2_transport_strike(), when a transport enters PF state, it
expects to update the hb timer to resend a heartbeat every rto after
calling sctp_transport_reset_hb_timer(), which will not work as the
change mentioned above.

The frequently hb_timer refresh was caused by sctp_transport_reset_timers()
called in sctp_outq_flush() and it was already removed in the commit above.
So we don't have to check hb_timer.expires when resetting hb_timer as it is
now not called very often.

Fixes: ba6f5e33bdbb ("sctp: avoid refreshing heartbeat timer too often")
Signed-off-by: Xin Long <lucien.xin@gmail.com>
---
 net/sctp/transport.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Marcelo Ricardo Leitner Jan. 30, 2023, 4:32 p.m. UTC | #1
On Mon, Jan 30, 2023 at 11:25:33AM -0500, Xin Long wrote:
> It tries to avoid the frequently hb_timer refresh in commit ba6f5e33bdbb
> ("sctp: avoid refreshing heartbeat timer too often"), and it only allows
> mod_timer when the new expires is after hb_timer.expires. It means even
> a much shorter interval for hb timer gets applied, it will have to wait
> until the current hb timer to time out.
> 
> In sctp_do_8_2_transport_strike(), when a transport enters PF state, it
> expects to update the hb timer to resend a heartbeat every rto after
> calling sctp_transport_reset_hb_timer(), which will not work as the
> change mentioned above.
> 
> The frequently hb_timer refresh was caused by sctp_transport_reset_timers()
> called in sctp_outq_flush() and it was already removed in the commit above.
> So we don't have to check hb_timer.expires when resetting hb_timer as it is
> now not called very often.
> 
> Fixes: ba6f5e33bdbb ("sctp: avoid refreshing heartbeat timer too often")
> Signed-off-by: Xin Long <lucien.xin@gmail.com>

Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
patchwork-bot+netdevbpf@kernel.org Feb. 1, 2023, 5:10 a.m. UTC | #2
Hello:

This patch was applied to netdev/net.git (master)
by Jakub Kicinski <kuba@kernel.org>:

On Mon, 30 Jan 2023 11:25:33 -0500 you wrote:
> It tries to avoid the frequently hb_timer refresh in commit ba6f5e33bdbb
> ("sctp: avoid refreshing heartbeat timer too often"), and it only allows
> mod_timer when the new expires is after hb_timer.expires. It means even
> a much shorter interval for hb timer gets applied, it will have to wait
> until the current hb timer to time out.
> 
> In sctp_do_8_2_transport_strike(), when a transport enters PF state, it
> expects to update the hb timer to resend a heartbeat every rto after
> calling sctp_transport_reset_hb_timer(), which will not work as the
> change mentioned above.
> 
> [...]

Here is the summary with links:
  - [net] sctp: do not check hb_timer.expires when resetting hb_timer
    https://git.kernel.org/netdev/net/c/8f35ae17ef56

You are awesome, thank you!
diff mbox series

Patch

diff --git a/net/sctp/transport.c b/net/sctp/transport.c
index ca1eba95c293..2f66a2006517 100644
--- a/net/sctp/transport.c
+++ b/net/sctp/transport.c
@@ -196,9 +196,7 @@  void sctp_transport_reset_hb_timer(struct sctp_transport *transport)
 
 	/* When a data chunk is sent, reset the heartbeat interval.  */
 	expires = jiffies + sctp_transport_timeout(transport);
-	if ((time_before(transport->hb_timer.expires, expires) ||
-	     !timer_pending(&transport->hb_timer)) &&
-	    !mod_timer(&transport->hb_timer,
+	if (!mod_timer(&transport->hb_timer,
 		       expires + get_random_u32_below(transport->rto)))
 		sctp_transport_hold(transport);
 }