diff mbox series

[net-next,1/3] tcp: small changes in reqsk_put() and reqsk_free()

Message ID 20240605071553.1365557-2-edumazet@google.com (mailing list archive)
State Accepted
Commit c34506406dd5cfb352f8c53bb6a1b9535c0905dd
Delegated to: Netdev Maintainers
Headers show
Series tcp: small code reorg | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 2918 this patch: 2918
netdev/build_tools success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers success CCed 4 of 4 maintainers
netdev/build_clang success Errors and warnings before: 946 this patch: 946
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 3101 this patch: 3101
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 16 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 1 this patch: 1
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-06-05--15-00 (tests: 1043)

Commit Message

Eric Dumazet June 5, 2024, 7:15 a.m. UTC
In reqsk_free(), use DEBUG_NET_WARN_ON_ONCE()
instead of WARN_ON_ONCE() for a condition which never fired.

In reqsk_put() directly call __reqsk_free(), there is no
point checking rsk_refcnt again right after a transition to zero.

Signed-off-by: Eric Dumazet <edumazet@google.com>
---
 include/net/request_sock.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Kuniyuki Iwashima June 5, 2024, 6:29 p.m. UTC | #1
Date: Wed,  5 Jun 2024 07:15:51 +0000
From: Eric Dumazet <edumazet@google.com>
> In reqsk_free(), use DEBUG_NET_WARN_ON_ONCE()
> instead of WARN_ON_ONCE() for a condition which never fired.
> 
> In reqsk_put() directly call __reqsk_free(), there is no
> point checking rsk_refcnt again right after a transition to zero.
> 
> Signed-off-by: Eric Dumazet <edumazet@google.com>

Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>
diff mbox series

Patch

diff --git a/include/net/request_sock.h b/include/net/request_sock.h
index ebcb8896bffc..a8f82216c628 100644
--- a/include/net/request_sock.h
+++ b/include/net/request_sock.h
@@ -172,14 +172,14 @@  static inline void __reqsk_free(struct request_sock *req)
 
 static inline void reqsk_free(struct request_sock *req)
 {
-	WARN_ON_ONCE(refcount_read(&req->rsk_refcnt) != 0);
+	DEBUG_NET_WARN_ON_ONCE(refcount_read(&req->rsk_refcnt) != 0);
 	__reqsk_free(req);
 }
 
 static inline void reqsk_put(struct request_sock *req)
 {
 	if (refcount_dec_and_test(&req->rsk_refcnt))
-		reqsk_free(req);
+		__reqsk_free(req);
 }
 
 /*