aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/inet_diag.c
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2013-10-03 17:27:25 -0400
committerDavid S. Miller <davem@davemloft.net>2013-10-03 17:43:39 -0400
commit96f817fedec48b59c9e8b22141cec4e56ad47913 (patch)
tree81ca60148cfc015a3cfdb5b4d14a7b23f41cf2ac /net/ipv4/inet_diag.c
parent40dc9ab277eb3d2d3d3442c20accb5dfa577e680 (diff)
tcp: shrink tcp6_timewait_sock by one cache line
While working on tcp listener refactoring, I found that it would really make things easier if sock_common could include the IPv6 addresses needed in the lookups, instead of doing very complex games to get their values (depending on sock being SYN_RECV, ESTABLISHED, TIME_WAIT) For this to happen, I need to be sure that tcp6_timewait_sock and tcp_timewait_sock consume same number of cache lines. This is possible if we only use 32bits for tw_ttd, as we remove one 32bit hole in inet_timewait_sock inet_tw_time_stamp() is defined and used, even if its current implementation looks like tcp_time_stamp : We might need finer resolution for tcp_time_stamp in the future. Before patch : sizeof(struct tcp6_timewait_sock) = 0xc8 After patch : sizeof(struct tcp6_timewait_sock) = 0xc0 Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/inet_diag.c')
-rw-r--r--net/ipv4/inet_diag.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c
index 5f648751fce2..22000279efc8 100644
--- a/net/ipv4/inet_diag.c
+++ b/net/ipv4/inet_diag.c
@@ -222,7 +222,7 @@ static int inet_twsk_diag_fill(struct inet_timewait_sock *tw,
222 u32 portid, u32 seq, u16 nlmsg_flags, 222 u32 portid, u32 seq, u16 nlmsg_flags,
223 const struct nlmsghdr *unlh) 223 const struct nlmsghdr *unlh)
224{ 224{
225 long tmo; 225 s32 tmo;
226 struct inet_diag_msg *r; 226 struct inet_diag_msg *r;
227 struct nlmsghdr *nlh; 227 struct nlmsghdr *nlh;
228 228
@@ -234,7 +234,7 @@ static int inet_twsk_diag_fill(struct inet_timewait_sock *tw,
234 r = nlmsg_data(nlh); 234 r = nlmsg_data(nlh);
235 BUG_ON(tw->tw_state != TCP_TIME_WAIT); 235 BUG_ON(tw->tw_state != TCP_TIME_WAIT);
236 236
237 tmo = tw->tw_ttd - jiffies; 237 tmo = tw->tw_ttd - inet_tw_time_stamp();
238 if (tmo < 0) 238 if (tmo < 0)
239 tmo = 0; 239 tmo = 0;
240 240
@@ -248,7 +248,7 @@ static int inet_twsk_diag_fill(struct inet_timewait_sock *tw,
248 r->id.idiag_dst[0] = tw->tw_daddr; 248 r->id.idiag_dst[0] = tw->tw_daddr;
249 r->idiag_state = tw->tw_substate; 249 r->idiag_state = tw->tw_substate;
250 r->idiag_timer = 3; 250 r->idiag_timer = 3;
251 r->idiag_expires = DIV_ROUND_UP(tmo * 1000, HZ); 251 r->idiag_expires = jiffies_to_msecs(tmo);
252 r->idiag_rqueue = 0; 252 r->idiag_rqueue = 0;
253 r->idiag_wqueue = 0; 253 r->idiag_wqueue = 0;
254 r->idiag_uid = 0; 254 r->idiag_uid = 0;