Skip to content

Commit 649091e

Browse files
edumazetkuba-moo
authored andcommitted
tcp: reclaim 8 bytes in struct request_sock_queue
synflood_warned had to be u32 for xchg(), but ensuring atomicity is not really needed. Signed-off-by: Eric Dumazet <[email protected]> Reviewed-by: Kuniyuki Iwashima <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 31c4511 commit 649091e

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

include/net/request_sock.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,8 @@ struct fastopen_queue {
185185
struct request_sock_queue {
186186
spinlock_t rskq_lock;
187187
u8 rskq_defer_accept;
188+
u8 synflood_warned;
188189

189-
u32 synflood_warned;
190190
atomic_t qlen;
191191
atomic_t young;
192192

net/ipv4/tcp_input.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7282,8 +7282,8 @@ static bool tcp_syn_flood_action(struct sock *sk, const char *proto)
72827282
#endif
72837283
__NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPREQQFULLDROP);
72847284

7285-
if (!READ_ONCE(queue->synflood_warned) && syncookies != 2 &&
7286-
xchg(&queue->synflood_warned, 1) == 0) {
7285+
if (syncookies != 2 && !READ_ONCE(queue->synflood_warned)) {
7286+
WRITE_ONCE(queue->synflood_warned, 1);
72877287
if (IS_ENABLED(CONFIG_IPV6) && sk->sk_family == AF_INET6) {
72887288
net_info_ratelimited("%s: Possible SYN flooding on port [%pI6c]:%u. %s.\n",
72897289
proto, inet6_rcv_saddr(sk),

0 commit comments

Comments
 (0)