Skip to contentSkip to conversation

tcp: add sk->sk_synq_overflow_ts

PATCH In review Eric Dumazet 1 participant 2 messages Apr 29

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tcp: add sk->sk_synq_overflow_ts

tcp_synq_overflow() and tcp_synq_no_recent_overflow() are currently using tp->rx_opt.ts_recent_stamp to store a 32bit jiffie value.

Use instead full "unsigned long" storage, as an union with sk->sk_stamp which is not used by a TCP listener.

As a bonus, we can remove time_between32() from include/linux/time.h.

---
 include/linux/time.h         | 13 ---------
 include/net/sock.h           |  5 +++-
 include/net/sock_reuseport.h |  2 +-
 include/net/tcp.h            | 56 ++++++++++++------------------------
 4 files changed, 24 insertions(+), 52 deletions(-)
include/linux/time.h +0 -13
index 16cf4522d6f338176f1fa753360e8bdec2c7bc8d..7554e44ea4a9472d306c770e2e6d2907ef5f244a 100644
@@ -84,19 +84,6 @@ static inline bool itimerspec64_valid(const struct itimerspec64 *its)
 #define time_after32(a, b)	((s32)((u32)(b) - (u32)(a)) < 0)
 #define time_before32(b, a)	time_after32(a, b)
 
-/**
- * time_between32 - check if a 32-bit timestamp is within a given time range
- * @t:	the time which may be within [l,h]
- * @l:	the lower bound of the range
- * @h:	the higher bound of the range
- *
- * time_before32(t, l, h) returns true if @l <= @t <= @h. All operands are
- * treated as 32-bit integers.
- *
- * Equivalent to !(time_before32(@t, @l) || time_after32(@t, @h)).
- */
-#define time_between32(t, l, h) ((u32)(h) - (u32)(l) >= (u32)(t) - (u32)(l))
-
 # include <vdso/time.h>
 
 #endif
include/net/sock.h +4 -1
index dccd3738c3687056b67c8de44fce9842dcc365ec..ed1e52de43c3394fae74f45a85527dec08c7ec48 100644
@@ -548,7 +548,10 @@ struct sock {
 	struct pid		*sk_peer_pid;
 	const struct cred	*sk_peer_cred;
 
-	ktime_t			sk_stamp;
+	union {
+		ktime_t		sk_stamp;
+		unsigned long	sk_synq_overflow_ts; /* tcp_synq_overflow */
+	};
 #if BITS_PER_LONG==32
 	seqlock_t		sk_stamp_seq;
 #endif
include/net/sock_reuseport.h +1 -1
index 6e4faf3ee76fbd86e2c4ac6ff13ead5c9a9187d6..a6beda5dca40777e27ef071d777081fd8af6ea03 100644
@@ -20,7 +20,7 @@ struct sock_reuseport {
 	/* The last synq overflow event timestamp of this
 	 * reuse->socks[] group.
 	 */
-	unsigned int		synq_overflow_ts;
+	unsigned long		synq_overflow_ts;
 	/* ID stays the same even after the size of socks[] grows. */
 	unsigned int		reuseport_id;
 	unsigned int		bind_inany:1;
include/net/tcp.h +19 -37

75 lines not on this page · raw message

Signature · 1 line
2.54.0.545.g6539524ca2-goog
#1 lore raw
Quoted 8 lines · Eric Dumazet

tcp_synq_overflow() and tcp_synq_no_recent_overflow() are currently using tp->rx_opt.ts_recent_stamp to store a 32bit jiffie value.

Use instead full "unsigned long" storage, as an union with sk->sk_stamp which is not used by a TCP listener.

As a bonus, we can remove time_between32() from include/linux/time.h.

Please disregard this, I sent a wrong version of this patch.

pw-bot: cr