netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3] sctp: Add buffer utilization fields to /proc/net/sctp/assocs
@ 2013-04-12 23:22 Dilip Daya
  2013-04-12 23:28 ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Dilip Daya @ 2013-04-12 23:22 UTC (permalink / raw)
  To: Linux Netdev List, linux-sctp; +Cc: nhorman, dborkman

From: Dilip Daya <dilip.daya@hp.com>

This patch adds the following fields to /proc/net/sctp/assocs output:

	- sk->sk_wmem_alloc as "wmema"	(transmit queue bytes committed)
	- sk->sk_wmem_queued as "wmemq"	(persistent queue size)
	- sk->sk_sndbuf as "sndbuf"	(size of send buffer in bytes)
	- sk->sk_rcvbuf as "rcvbuf"	(size of receive buffer in bytes)

When small DATA chunks containing 136 bytes data are sent the TX_QUEUE
(assoc->sndbuf_used) reaches a maximum of 40.9% of sk_sndbuf value when
peer.rwnd = 0. This was diagnosed from sk_wmem_alloc value reaching maximum
value of sk_sndbuf.

TX_QUEUE (assoc->sndbuf_used), sk_wmem_alloc and sk_wmem_queued values are
incremented in sctp_set_owner_w() for outgoing data chunks. Having access to
the above values in /proc/net/sctp/assocs will provide a better understanding
of SCTP buffer management.

With patch applied, example output when peer.rwnd = 0

where:
    ASSOC ffff880132298000 is sender
          ffff880125343000 is receiver

 ASSOC           SOCK            STY SST ST  HBKT ASSOC-ID TX_QUEUE RX_QUEUE \
ffff880132298000 ffff880124a0a0c0 2   1   3  29325    1      214656        0 \
ffff880125343000 ffff8801237d7700 2   1   3  36210    2           0   524520 \

UID   INODE LPORT  RPORT LADDRS <-> RADDRS       HBINT   INS  OUTS \
  0   25108 3455   3456  *10.4.8.3 <-> *10.5.8.3  7500     2     2 \
  0   27819 3456   3455  *10.5.8.3 <-> *10.4.8.3  7500     2     2 \

MAXRT T1X  T2X     RTXC       wmema          wmemq      sndbuf    rcvbuf
    4   0   0        72      525633         440320      524288    524288
    4   0   0         0           1              0      524288    524288

Signed-off-by: Dilip Daya <dilip.daya@hp.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
---
 net/sctp/proc.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

v3: Fixed fields names, indentation and ancillary information.
v2: Not changing spacing between the fields.

Patch applies to v3.8.6 and v3.9-rc6.

diff --git a/net/sctp/proc.c b/net/sctp/proc.c
index 8c19e97..b0f2ee7 100644
--- a/net/sctp/proc.c
+++ b/net/sctp/proc.c
@@ -296,7 +296,8 @@ static void * sctp_assocs_seq_start(struct seq_file *seq, loff_t *pos)
 		seq_printf(seq, " ASSOC     SOCK   STY SST ST HBKT "
 				"ASSOC-ID TX_QUEUE RX_QUEUE UID INODE LPORT "
 				"RPORT LADDRS <-> RADDRS "
-				"HBINT INS OUTS MAXRT T1X T2X RTXC\n");
+				"HBINT INS OUTS MAXRT T1X T2X RTXC "
+				"wmema wmemq sndbuf rcvbuf\n");
 
 	return (void *)pos;
 }
@@ -352,10 +353,16 @@ static int sctp_assocs_seq_show(struct seq_file *seq, void *v)
 		seq_printf(seq, "<-> ");
 		sctp_seq_dump_remote_addrs(seq, assoc);
 		seq_printf(seq, "\t%8lu %5d %5d %4d %4d %4d %8d ",
+		seq_printf(seq, "\t%8lu %5d %5d %4d %4d %4d %8d "
+			   "%8d %8d %8d %8d",
 			assoc->hbinterval, assoc->c.sinit_max_instreams,
 			assoc->c.sinit_num_ostreams, assoc->max_retrans,
 			assoc->init_retries, assoc->shutdown_retries,
-			assoc->rtx_data_chunks);
+			assoc->rtx_data_chunks,
+			atomic_read(&sk->sk_wmem_alloc),
+			sk->sk_wmem_queued,
+			sk->sk_sndbuf,
+			sk->sk_rcvbuf);
 		seq_printf(seq, "\n");
 	}
 	read_unlock(&head->lock);
-- 
1.5.6.5

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v3] sctp: Add buffer utilization fields to /proc/net/sctp/assocs
  2013-04-12 23:22 [PATCH v3] sctp: Add buffer utilization fields to /proc/net/sctp/assocs Dilip Daya
@ 2013-04-12 23:28 ` David Miller
  2013-04-12 23:29   ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: David Miller @ 2013-04-12 23:28 UTC (permalink / raw)
  To: dilip.daya; +Cc: netdev, linux-sctp, nhorman, dborkman

From: Dilip Daya <dilip.daya@hp.com>
Date: Fri, 12 Apr 2013 19:22:11 -0400

> From: Dilip Daya <dilip.daya@hp.com>
> 
> This patch adds the following fields to /proc/net/sctp/assocs output:
> 
> 	- sk->sk_wmem_alloc as "wmema"	(transmit queue bytes committed)
> 	- sk->sk_wmem_queued as "wmemq"	(persistent queue size)
> 	- sk->sk_sndbuf as "sndbuf"	(size of send buffer in bytes)
> 	- sk->sk_rcvbuf as "rcvbuf"	(size of receive buffer in bytes)
 ...
> Signed-off-by: Dilip Daya <dilip.daya@hp.com>
> Acked-by: Neil Horman <nhorman@tuxdriver.com>

Looks good, applied, thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v3] sctp: Add buffer utilization fields to /proc/net/sctp/assocs
  2013-04-12 23:28 ` David Miller
@ 2013-04-12 23:29   ` David Miller
  0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2013-04-12 23:29 UTC (permalink / raw)
  To: dilip.daya; +Cc: netdev, linux-sctp, nhorman, dborkman

From: David Miller <davem@davemloft.net>
Date: Fri, 12 Apr 2013 19:28:00 -0400 (EDT)

> Looks good, applied, thanks.

Actually, no, this is completely broken:

net/sctp/proc.c: In function ‘sctp_assocs_seq_show’:
net/sctp/proc.c:363:18: error: expected ‘)’ before ‘;’ token
net/sctp/proc.c:365:2: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘int’ [-Wformat]
net/sctp/proc.c:365:2: warning: format ‘%d’ expects a matching ‘int’ argument [-Wformat]
net/sctp/proc.c:365:2: warning: format ‘%d’ expects a matching ‘int’ argument [-Wformat]
net/sctp/proc.c:365:2: warning: format ‘%d’ expects a matching ‘int’ argument [-Wformat]
net/sctp/proc.c:365:2: warning: format ‘%d’ expects a matching ‘int’ argument [-Wformat]
net/sctp/proc.c:365:2: warning: format ‘%d’ expects a matching ‘int’ argument [-Wformat]
net/sctp/proc.c:365:2: warning: format ‘%d’ expects a matching ‘int’ argument [-Wformat]
net/sctp/proc.c:365:2: error: expected ‘;’ before ‘}’ token
make[1]: *** [net/sctp/proc.o] Error 1
make: *** [net/sctp/proc.o] Error 2

You didn't even compile test this.

I think I'll ignore your submissions for a while, your analysis is
extremely poor if you don't think you need to build test after
"simple" edits of your changes.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-04-12 23:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-12 23:22 [PATCH v3] sctp: Add buffer utilization fields to /proc/net/sctp/assocs Dilip Daya
2013-04-12 23:28 ` David Miller
2013-04-12 23:29   ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).