Skip to contentSkip to conversation

inet_diag: Extend the meminfo report

PATCH In review Pavel Emelyanov 2 participants 4 messages Dec 28, 2011

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

PATCH 3/5 inet_diag: Extend the meminfo report

Add the backlog length and wmem and rmem buffers limits. With this the TCP memory info is full and can be analyzed.

Few words about extending the existing structure. The nla engine stores lengths of fields and the nla parser will parse the new format successfully (checked on the ss tool). But new apps will have to take this field's length into account. Hopefully this is acceptable price for not introducing another ext bit and structure.

---
 include/linux/inet_diag.h |    3 +++
 net/ipv4/inet_diag.c      |    3 +++
 2 files changed, 6 insertions(+), 0 deletions(-)
include/linux/inet_diag.h +3 -0
index afa5d5c..d274712 100644
@@ -120,6 +120,9 @@ struct inet_diag_meminfo {
 	__u32	idiag_wmem;
 	__u32	idiag_fmem;
 	__u32	idiag_tmem;
+	__u32	idiag_backlog;
+	__u32	idiag_rcvbuf;
+	__u32	idiag_sndbuf;
 };
 
 /* INET_DIAG_VEGASINFO */
net/ipv4/inet_diag.c +3 -0
index fb2e47f..91f9092 100644
@@ -134,6 +134,9 @@ int inet_sk_diag_fill(struct sock *sk, struct inet_connection_sock *icsk,
 		minfo->idiag_wmem = sk->sk_wmem_queued;
 		minfo->idiag_fmem = sk->sk_forward_alloc;
 		minfo->idiag_tmem = sk_wmem_alloc_get(sk);
+		minfo->idiag_backlog = sk->sk_backlog.len;
+		minfo->idiag_rcvbuf = sk->sk_rcvbuf;
+		minfo->idiag_sndbuf = sk->sk_sndbuf;
 	}
 
 	if (icsk == NULL) {
Signature · 1 line
1.5.5.6
maintainer
#1 lore raw

From: Pavel Emelyanov <[email protected]>
Date: Wed, 28 Dec 2011 17:38:40 +0400

Quoted 9 lines

Add the backlog length and wmem and rmem buffers limits. With this the TCP memory info is full and can be analyzed.

Few words about extending the existing structure. The nla engine stores lengths of fields and the nla parser will parse the new format successfully (checked on the ss tool). But new apps will have to take this field's length into account. Hopefully this is acceptable price for not introducing another ext bit and structure.

I think you'll need to add a new extension, rather than create this incompatability.

#2 lore raw
Quoted 6 lines · David Miller

From: Pavel Emelyanov <[email protected]>
Date: Wed, 28 Dec 2011 17:38:40 +0400

Quoted 3 lines

Add the backlog length and wmem and rmem buffers limits. With this the TCP memory info is full and can be analyzed.

Quoted 9 lines
Quoted 6 lines

Few words about extending the existing structure. The nla engine stores lengths of fields and the nla parser will parse the new format successfully (checked on the ss tool). But new apps will have to take this field's length into account. Hopefully this is acceptable price for not introducing another ext bit and structure.

I think you'll need to add a new extension, rather than create this incompatability.

OK, I will, but I seem to misunderstand the NLA's length value then. My impression is that it was introduced to make it possible to put the payload of different length, probably adding more stuff at the end.

If I'm wrong about it, what is the real purpose of this field? _Only_ to make nla_parse jump on the "generic" offsets?

Thanks,
Pavel

maintainer
#3 lore raw

From: Pavel Emelyanov <[email protected]>
Date: Wed, 28 Dec 2011 22:58:57 +0400

Quoted 12 lines · David Miller
Quoted 11 lines

From: Pavel Emelyanov <[email protected]>
Date: Wed, 28 Dec 2011 17:38:40 +0400

Quoted 8 lines

Add the backlog length and wmem and rmem buffers limits. With this the TCP memory info is full and can be analyzed.

Few words about extending the existing structure. The nla engine stores lengths of fields and the nla parser will parse the new format successfully (checked on the ss tool). But new apps will have to take this field's length into account. Hopefully this is acceptable price for not introducing another ext bit and structure.

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

I think you'll need to add a new extension, rather than create this incompatability.

OK, I will, but I seem to misunderstand the NLA's length value then. My impression is that it was introduced to make it possible to put the payload of different length, probably adding more stuff at the end.

It's to validate that the object inside the attribute has the expected length.