tcp: move __reqsk_free() out of line
Subsystems (3)
PATCH 1/1 tcp: move __reqsk_free() out of line
Inlining __reqsk_free() is overkill, let's reclaim 2 Kbytes of text.
scripts/bloat-o-meter -t vmlinux.old vmlinux.new add/remove: 2/2 grow/shrink: 1/14 up/down: 194/-2276 (-2082)
Function old new delta__reqsk_free - 114 +114
sock_edemux 18 82 +64 __pfx___reqsk_free - 16 +16 __pfx_reqsk_free 16 - -16 tcp_req_err 272 177 -95 reqsk_fastopen_remove 348 253 -95 cookie_bpf_check 157 62 -95 cookie_tcp_reqsk_alloc 387 290 -97 cookie_v4_check 1568 1465 -103 reqsk_free 105 - -105 cookie_v6_check 1519 1412 -107 sock_gen_put 187 78 -109 sock_pfree 212 82 -130 tcp_try_fastopen 1818 1683 -135 tcp_v4_rcv 3478 3294 -184 reqsk_put 306 90 -216 tcp_get_cookie_sock 551 318 -233 tcp_v6_rcv 3404 3141 -263 tcp_conn_request 2677 2384 -293
Total: Before=22582599, After=22580517, chg -0.01%
--- include/net/request_sock.h | 9 +-------- net/ipv4/inet_connection_sock.c | 10 ++++++++++ 2 files changed, 11 insertions(+), 8 deletions(-)
include/net/request_sock.h +1 -8
@@ -123,14 +123,7 @@ static inline struct sock *skb_steal_sock(struct sk_buff *skb,return sk; } -static inline void __reqsk_free (struct request_sock *req) -{ - req->rsk_ops->destructor (req); -if (req->rsk_listener) -sock_put (req->rsk_listener); -kfree (req->saved_syn); -kmem_cache_free (req->rsk_ops->slab, req); -} +void __reqsk_free (struct request_sock *req);static inline void reqsk_free (struct request_sock *req) {
net/ipv4/inet_connection_sock.c +10 -0
@@ -918,6 +918,16 @@ struct request_sock *inet_reqsk_alloc(const struct request_sock_ops *ops, }EXPORT_SYMBOL (inet_reqsk_alloc); +void __reqsk_free (struct request_sock *req) +{ + req->rsk_ops->destructor (req); +if (req->rsk_listener) +sock_put (req->rsk_listener); +kfree (req->saved_syn); +kmem_cache_free (req->rsk_ops->slab, req); +} +EXPORT_IPV6_MOD_GPL (__reqsk_free); +static struct request_sock *inet_reqsk_clone (struct request_sock *req,struct sock *sk) {
Signature · 1 line
2.53.0.rc1.225.gd81095ad13-goog
kernel test robot
build botkernel test robot noticed the following build errors:
Hi Eric,
kernel test robot noticed the following build errors:
[auto build test ERROR on net-next/main]
url: https://github.com/intel-lab-lkp/linux/commits/Eric-Dumazet/tcp-move-__reqsk_free-out-of-line/20260201-011758 base: net-next/main patch link: https://lore.kernel.org/r/20260131171627.1852894-1-edumazet%40google.com patch subject: [PATCH net-next] tcp: move __reqsk_free() out of line config: x86_64-buildonly-randconfig-003-20260201 (https://download.01.org/0day-ci/archive/20260201/[email protected]/config) compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260201/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>):
>> ld.lld: error: undefined symbol: __reqsk_free >>> referenced by request_sock.h:137 (include/net/request_sock.h:137) >>> net/core/request_sock.o:(reqsk_fastopen_remove) in archive vmlinux.a
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
kernel test robot
build botkernel test robot noticed the following build errors:
Hi Eric,
kernel test robot noticed the following build errors:
[auto build test ERROR on net-next/main]
url: https://github.com/intel-lab-lkp/linux/commits/Eric-Dumazet/tcp-move-__reqsk_free-out-of-line/20260201-011758 base: net-next/main patch link: https://lore.kernel.org/r/20260131171627.1852894-1-edumazet%40google.com patch subject: [PATCH net-next] tcp: move __reqsk_free() out of line config: um-randconfig-001-20260201 (https://download.01.org/0day-ci/archive/20260201/[email protected]/config) compiler: clang version 22.0.0git (https://github.com/llvm/llvm-project 9b8addffa70cee5b2acc5454712d9cf78ce45710) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260201/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>):
/usr/bin/ld: warning: .tmp_vmlinux1 has a LOAD segment with RWX permissions /usr/bin/ld: net/core/request_sock.o: in function `reqsk_fastopen_remove':
>> include/net/request_sock.h:137:(.ltext+0x103): undefined reference to `__reqsk_free'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
vim +137 include/net/request_sock.h
9403cf23025880 Guillaume Nault 2019-03-19 133
1e2e01172fd11b Eric Dumazet 2015-03-12 134 static inline void reqsk_put(struct request_sock *req)
1e2e01172fd11b Eric Dumazet 2015-03-12 135 {
41c6d650f6537e Reshetova, Elena 2017-06-30 136 if (refcount_dec_and_test(&req->rsk_refcnt))
c34506406dd5cf Eric Dumazet 2024-06-05 @137 __reqsk_free(req);
1e2e01172fd11b Eric Dumazet 2015-03-12 138 }
1e2e01172fd11b Eric Dumazet 2015-03-12 139 Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Quoted 30 lines · kernel test robot
Hi Eric,
kernel test robot noticed the following build errors:
[auto build test ERROR on net-next/main]
url: https://github.com/intel-lab-lkp/linux/commits/Eric-Dumazet/tcp-move-__reqsk_free-out-of-line/20260201-011758 base: net-next/main patch link: https://lore.kernel.org/r/20260131171627.1852894-1-edumazet%40google.com patch subject: [PATCH net-next] tcp: move __reqsk_free() out of line config: um-randconfig-001-20260201 (https://download.01.org/0day-ci/archive/20260201/[email protected]/config) compiler: clang version 22.0.0git (https://github.com/llvm/llvm-project 9b8addffa70cee5b2acc5454712d9cf78ce45710) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260201/[email protected]/reproduce)If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/All errors (new ones prefixed by >>):
/usr/bin/ld: warning: .tmp_vmlinux1 has a LOAD segment with RWX permissions/usr/bin/ld:net/core/request_sock.o: in function `reqsk_fastopen_remove':Quoted 1 line
Quoted 1 line
include/net/request_sock.h:137:(.ltext+0x103): undefined reference to `__reqsk_free'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
vim +137
include/net/request_sock.h
Quoted 8 lines
9403cf23025880 Guillaume Nault 2019-03-19 133
1e2e01172fd11b Eric Dumazet 2015-03-12 134 static inline void reqsk_put(struct request_sock *req)
1e2e01172fd11b Eric Dumazet 2015-03-12 135 {
41c6d650f6537e Reshetova, Elena 2017-06-30 136 if (refcount_dec_and_test(&req->rsk_refcnt))
c34506406dd5cf Eric Dumazet 2024-06-05 @137 __reqsk_free(req);
1e2e01172fd11b Eric Dumazet 2015-03-12 138 }
1e2e01172fd11b Eric Dumazet 2015-03-12 139Great, time to get rid of net/core/request_sock.c
I will send in V2 a series with these 3 patches before moving __reqsk_free out of line.
commit a79b5cb06e365dc8d3e1fb4872ec861266306c14
Author: Eric Dumazet <[email protected]> Date: Sun Feb 1 08:12:11 2026 +0000
net: get rid of net/core/request_sock.c
After DCCP removal, this file was not needed any more.
commit 58ab84ff63932e13f1c59aa45493333c04e6f4df
Author: Eric Dumazet <[email protected]> Date: Sun Feb 1 08:08:40 2026 +0000
tcp: move reqsk_fastopen_remove to net/ipv4/tcp_fastopen.c
This function belongs to TCP stack, not to net/core/request_sock.c
We get rid of the now empty request_sock.c n the following patch.
commit 1718fc81eb4742c1eab842852e600b906a08fded
Author: Eric Dumazet <[email protected]> Date: Sun Feb 1 08:00:42 2026 +0000
inet: move reqsk_queue_alloc() to net/ipv4/inet_connection_sock.c
Only called once from inet_csk_listen_start(), it can be static.