diff options
author | Eric Dumazet <eric.dumazet@gmail.com> | 2009-06-17 22:05:41 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-06-18 03:29:12 -0400 |
commit | 31e6d363abcd0d05766c82f1a9c905a4c974a199 (patch) | |
tree | f2b5c46354d95f91e743ae748b8add0de8bffd17 /net | |
parent | d3b238a03efd6d644ff93c8b10a1d38a596f2e34 (diff) |
net: correct off-by-one write allocations reports
commit 2b85a34e911bf483c27cfdd124aeb1605145dc80
(net: No more expensive sock_hold()/sock_put() on each tx)
changed initial sk_wmem_alloc value.
We need to take into account this offset when reporting
sk_wmem_alloc to user, in PROC_FS files or various
ioctls (SIOCOUTQ/TIOCOUTQ)
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/appletalk/atalk_proc.c | 4 | ||||
-rw-r--r-- | net/appletalk/ddp.c | 3 | ||||
-rw-r--r-- | net/ax25/af_ax25.c | 11 | ||||
-rw-r--r-- | net/bluetooth/af_bluetooth.c | 2 | ||||
-rw-r--r-- | net/decnet/af_decnet.c | 2 | ||||
-rw-r--r-- | net/ieee802154/dgram.c | 3 | ||||
-rw-r--r-- | net/ipv4/inet_diag.c | 4 | ||||
-rw-r--r-- | net/ipv4/raw.c | 7 | ||||
-rw-r--r-- | net/ipv4/udp.c | 7 | ||||
-rw-r--r-- | net/ipv6/raw.c | 7 | ||||
-rw-r--r-- | net/ipv6/udp.c | 4 | ||||
-rw-r--r-- | net/ipx/af_ipx.c | 2 | ||||
-rw-r--r-- | net/ipx/ipx_proc.c | 4 | ||||
-rw-r--r-- | net/irda/af_irda.c | 3 | ||||
-rw-r--r-- | net/key/af_key.c | 4 | ||||
-rw-r--r-- | net/llc/llc_proc.c | 4 | ||||
-rw-r--r-- | net/netlink/af_netlink.c | 4 | ||||
-rw-r--r-- | net/netrom/af_netrom.c | 6 | ||||
-rw-r--r-- | net/packet/af_packet.c | 3 | ||||
-rw-r--r-- | net/rose/af_rose.c | 7 | ||||
-rw-r--r-- | net/sched/em_meta.c | 4 | ||||
-rw-r--r-- | net/sctp/socket.c | 4 | ||||
-rw-r--r-- | net/unix/af_unix.c | 2 | ||||
-rw-r--r-- | net/x25/af_x25.c | 4 | ||||
-rw-r--r-- | net/x25/x25_proc.c | 4 |
25 files changed, 58 insertions, 51 deletions
diff --git a/net/appletalk/atalk_proc.c b/net/appletalk/atalk_proc.c index fd8e0847b254..80caad1a31a5 100644 --- a/net/appletalk/atalk_proc.c +++ b/net/appletalk/atalk_proc.c | |||
@@ -204,8 +204,8 @@ static int atalk_seq_socket_show(struct seq_file *seq, void *v) | |||
204 | "%02X %d\n", | 204 | "%02X %d\n", |
205 | s->sk_type, ntohs(at->src_net), at->src_node, at->src_port, | 205 | s->sk_type, ntohs(at->src_net), at->src_node, at->src_port, |
206 | ntohs(at->dest_net), at->dest_node, at->dest_port, | 206 | ntohs(at->dest_net), at->dest_node, at->dest_port, |
207 | atomic_read(&s->sk_wmem_alloc), | 207 | sk_wmem_alloc_get(s), |
208 | atomic_read(&s->sk_rmem_alloc), | 208 | sk_rmem_alloc_get(s), |
209 | s->sk_state, SOCK_INODE(s->sk_socket)->i_uid); | 209 | s->sk_state, SOCK_INODE(s->sk_socket)->i_uid); |
210 | out: | 210 | out: |
211 | return 0; | 211 | return 0; |
diff --git a/net/appletalk/ddp.c b/net/appletalk/ddp.c index f7a53b219ef0..590b83963622 100644 --- a/net/appletalk/ddp.c +++ b/net/appletalk/ddp.c | |||
@@ -1748,8 +1748,7 @@ static int atalk_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) | |||
1748 | switch (cmd) { | 1748 | switch (cmd) { |
1749 | /* Protocol layer */ | 1749 | /* Protocol layer */ |
1750 | case TIOCOUTQ: { | 1750 | case TIOCOUTQ: { |
1751 | long amount = sk->sk_sndbuf - | 1751 | long amount = sk->sk_sndbuf - sk_wmem_alloc_get(sk); |
1752 | atomic_read(&sk->sk_wmem_alloc); | ||
1753 | 1752 | ||
1754 | if (amount < 0) | 1753 | if (amount < 0) |
1755 | amount = 0; | 1754 | amount = 0; |
diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c index 61b35b955490..da0f64f82b57 100644 --- a/net/ax25/af_ax25.c +++ b/net/ax25/af_ax25.c | |||
@@ -1690,7 +1690,8 @@ static int ax25_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) | |||
1690 | switch (cmd) { | 1690 | switch (cmd) { |
1691 | case TIOCOUTQ: { | 1691 | case TIOCOUTQ: { |
1692 | long amount; | 1692 | long amount; |
1693 | amount = sk->sk_sndbuf - atomic_read(&sk->sk_wmem_alloc); | 1693 | |
1694 | amount = sk->sk_sndbuf - sk_wmem_alloc_get(sk); | ||
1694 | if (amount < 0) | 1695 | if (amount < 0) |
1695 | amount = 0; | 1696 | amount = 0; |
1696 | res = put_user(amount, (int __user *)argp); | 1697 | res = put_user(amount, (int __user *)argp); |
@@ -1780,8 +1781,8 @@ static int ax25_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) | |||
1780 | ax25_info.idletimer = ax25_display_timer(&ax25->idletimer) / (60 * HZ); | 1781 | ax25_info.idletimer = ax25_display_timer(&ax25->idletimer) / (60 * HZ); |
1781 | ax25_info.n2count = ax25->n2count; | 1782 | ax25_info.n2count = ax25->n2count; |
1782 | ax25_info.state = ax25->state; | 1783 | ax25_info.state = ax25->state; |
1783 | ax25_info.rcv_q = atomic_read(&sk->sk_rmem_alloc); | 1784 | ax25_info.rcv_q = sk_wmem_alloc_get(sk); |
1784 | ax25_info.snd_q = atomic_read(&sk->sk_wmem_alloc); | 1785 | ax25_info.snd_q = sk_rmem_alloc_get(sk); |
1785 | ax25_info.vs = ax25->vs; | 1786 | ax25_info.vs = ax25->vs; |
1786 | ax25_info.vr = ax25->vr; | 1787 | ax25_info.vr = ax25->vr; |
1787 | ax25_info.va = ax25->va; | 1788 | ax25_info.va = ax25->va; |
@@ -1921,8 +1922,8 @@ static int ax25_info_show(struct seq_file *seq, void *v) | |||
1921 | 1922 | ||
1922 | if (ax25->sk != NULL) { | 1923 | if (ax25->sk != NULL) { |
1923 | seq_printf(seq, " %d %d %lu\n", | 1924 | seq_printf(seq, " %d %d %lu\n", |
1924 | atomic_read(&ax25->sk->sk_wmem_alloc), | 1925 | sk_wmem_alloc_get(ax25->sk), |
1925 | atomic_read(&ax25->sk->sk_rmem_alloc), | 1926 | sk_rmem_alloc_get(ax25->sk), |
1926 | sock_i_ino(ax25->sk)); | 1927 | sock_i_ino(ax25->sk)); |
1927 | } else { | 1928 | } else { |
1928 | seq_puts(seq, " * * *\n"); | 1929 | seq_puts(seq, " * * *\n"); |
diff --git a/net/bluetooth/af_bluetooth.c b/net/bluetooth/af_bluetooth.c index 02b9baa1930b..0250e0600150 100644 --- a/net/bluetooth/af_bluetooth.c +++ b/net/bluetooth/af_bluetooth.c | |||
@@ -337,7 +337,7 @@ int bt_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) | |||
337 | if (sk->sk_state == BT_LISTEN) | 337 | if (sk->sk_state == BT_LISTEN) |
338 | return -EINVAL; | 338 | return -EINVAL; |
339 | 339 | ||
340 | amount = sk->sk_sndbuf - atomic_read(&sk->sk_wmem_alloc); | 340 | amount = sk->sk_sndbuf - sk_wmem_alloc_get(sk); |
341 | if (amount < 0) | 341 | if (amount < 0) |
342 | amount = 0; | 342 | amount = 0; |
343 | err = put_user(amount, (int __user *) arg); | 343 | err = put_user(amount, (int __user *) arg); |
diff --git a/net/decnet/af_decnet.c b/net/decnet/af_decnet.c index a5e3a593e472..d351b8db0df5 100644 --- a/net/decnet/af_decnet.c +++ b/net/decnet/af_decnet.c | |||
@@ -1240,7 +1240,7 @@ static int dn_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) | |||
1240 | return val; | 1240 | return val; |
1241 | 1241 | ||
1242 | case TIOCOUTQ: | 1242 | case TIOCOUTQ: |
1243 | amount = sk->sk_sndbuf - atomic_read(&sk->sk_wmem_alloc); | 1243 | amount = sk->sk_sndbuf - sk_wmem_alloc_get(sk); |
1244 | if (amount < 0) | 1244 | if (amount < 0) |
1245 | amount = 0; | 1245 | amount = 0; |
1246 | err = put_user(amount, (int __user *)arg); | 1246 | err = put_user(amount, (int __user *)arg); |
diff --git a/net/ieee802154/dgram.c b/net/ieee802154/dgram.c index 1779677aed46..14d39840dd62 100644 --- a/net/ieee802154/dgram.c +++ b/net/ieee802154/dgram.c | |||
@@ -126,7 +126,8 @@ static int dgram_ioctl(struct sock *sk, int cmd, unsigned long arg) | |||
126 | switch (cmd) { | 126 | switch (cmd) { |
127 | case SIOCOUTQ: | 127 | case SIOCOUTQ: |
128 | { | 128 | { |
129 | int amount = atomic_read(&sk->sk_wmem_alloc); | 129 | int amount = sk_wmem_alloc_get(sk); |
130 | |||
130 | return put_user(amount, (int __user *)arg); | 131 | return put_user(amount, (int __user *)arg); |
131 | } | 132 | } |
132 | 133 | ||
diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c index b0b273503e2a..a706a47f4dbb 100644 --- a/net/ipv4/inet_diag.c +++ b/net/ipv4/inet_diag.c | |||
@@ -156,10 +156,10 @@ static int inet_csk_diag_fill(struct sock *sk, | |||
156 | r->idiag_inode = sock_i_ino(sk); | 156 | r->idiag_inode = sock_i_ino(sk); |
157 | 157 | ||
158 | if (minfo) { | 158 | if (minfo) { |
159 | minfo->idiag_rmem = atomic_read(&sk->sk_rmem_alloc); | 159 | minfo->idiag_rmem = sk_rmem_alloc_get(sk); |
160 | minfo->idiag_wmem = sk->sk_wmem_queued; | 160 | minfo->idiag_wmem = sk->sk_wmem_queued; |
161 | minfo->idiag_fmem = sk->sk_forward_alloc; | 161 | minfo->idiag_fmem = sk->sk_forward_alloc; |
162 | minfo->idiag_tmem = atomic_read(&sk->sk_wmem_alloc); | 162 | minfo->idiag_tmem = sk_wmem_alloc_get(sk); |
163 | } | 163 | } |
164 | 164 | ||
165 | handler->idiag_get_info(sk, r, info); | 165 | handler->idiag_get_info(sk, r, info); |
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c index 3dc9171a272f..2979f14bb188 100644 --- a/net/ipv4/raw.c +++ b/net/ipv4/raw.c | |||
@@ -799,7 +799,8 @@ static int raw_ioctl(struct sock *sk, int cmd, unsigned long arg) | |||
799 | { | 799 | { |
800 | switch (cmd) { | 800 | switch (cmd) { |
801 | case SIOCOUTQ: { | 801 | case SIOCOUTQ: { |
802 | int amount = atomic_read(&sk->sk_wmem_alloc); | 802 | int amount = sk_wmem_alloc_get(sk); |
803 | |||
803 | return put_user(amount, (int __user *)arg); | 804 | return put_user(amount, (int __user *)arg); |
804 | } | 805 | } |
805 | case SIOCINQ: { | 806 | case SIOCINQ: { |
@@ -935,8 +936,8 @@ static void raw_sock_seq_show(struct seq_file *seq, struct sock *sp, int i) | |||
935 | seq_printf(seq, "%4d: %08X:%04X %08X:%04X" | 936 | seq_printf(seq, "%4d: %08X:%04X %08X:%04X" |
936 | " %02X %08X:%08X %02X:%08lX %08X %5d %8d %lu %d %p %d\n", | 937 | " %02X %08X:%08X %02X:%08lX %08X %5d %8d %lu %d %p %d\n", |
937 | i, src, srcp, dest, destp, sp->sk_state, | 938 | i, src, srcp, dest, destp, sp->sk_state, |
938 | atomic_read(&sp->sk_wmem_alloc), | 939 | sk_wmem_alloc_get(sp), |
939 | atomic_read(&sp->sk_rmem_alloc), | 940 | sk_rmem_alloc_get(sp), |
940 | 0, 0L, 0, sock_i_uid(sp), 0, sock_i_ino(sp), | 941 | 0, 0L, 0, sock_i_uid(sp), 0, sock_i_ino(sp), |
941 | atomic_read(&sp->sk_refcnt), sp, atomic_read(&sp->sk_drops)); | 942 | atomic_read(&sp->sk_refcnt), sp, atomic_read(&sp->sk_drops)); |
942 | } | 943 | } |
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index 8f4158d7c9a6..80e3812837ad 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c | |||
@@ -840,7 +840,8 @@ int udp_ioctl(struct sock *sk, int cmd, unsigned long arg) | |||
840 | switch (cmd) { | 840 | switch (cmd) { |
841 | case SIOCOUTQ: | 841 | case SIOCOUTQ: |
842 | { | 842 | { |
843 | int amount = atomic_read(&sk->sk_wmem_alloc); | 843 | int amount = sk_wmem_alloc_get(sk); |
844 | |||
844 | return put_user(amount, (int __user *)arg); | 845 | return put_user(amount, (int __user *)arg); |
845 | } | 846 | } |
846 | 847 | ||
@@ -1721,8 +1722,8 @@ static void udp4_format_sock(struct sock *sp, struct seq_file *f, | |||
1721 | seq_printf(f, "%4d: %08X:%04X %08X:%04X" | 1722 | seq_printf(f, "%4d: %08X:%04X %08X:%04X" |
1722 | " %02X %08X:%08X %02X:%08lX %08X %5d %8d %lu %d %p %d%n", | 1723 | " %02X %08X:%08X %02X:%08lX %08X %5d %8d %lu %d %p %d%n", |
1723 | bucket, src, srcp, dest, destp, sp->sk_state, | 1724 | bucket, src, srcp, dest, destp, sp->sk_state, |
1724 | atomic_read(&sp->sk_wmem_alloc), | 1725 | sk_wmem_alloc_get(sp), |
1725 | atomic_read(&sp->sk_rmem_alloc), | 1726 | sk_rmem_alloc_get(sp), |
1726 | 0, 0L, 0, sock_i_uid(sp), 0, sock_i_ino(sp), | 1727 | 0, 0L, 0, sock_i_uid(sp), 0, sock_i_ino(sp), |
1727 | atomic_read(&sp->sk_refcnt), sp, | 1728 | atomic_read(&sp->sk_refcnt), sp, |
1728 | atomic_read(&sp->sk_drops), len); | 1729 | atomic_read(&sp->sk_drops), len); |
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c index 36a090d87a3d..8b0b6f948063 100644 --- a/net/ipv6/raw.c +++ b/net/ipv6/raw.c | |||
@@ -1130,7 +1130,8 @@ static int rawv6_ioctl(struct sock *sk, int cmd, unsigned long arg) | |||
1130 | switch(cmd) { | 1130 | switch(cmd) { |
1131 | case SIOCOUTQ: | 1131 | case SIOCOUTQ: |
1132 | { | 1132 | { |
1133 | int amount = atomic_read(&sk->sk_wmem_alloc); | 1133 | int amount = sk_wmem_alloc_get(sk); |
1134 | |||
1134 | return put_user(amount, (int __user *)arg); | 1135 | return put_user(amount, (int __user *)arg); |
1135 | } | 1136 | } |
1136 | case SIOCINQ: | 1137 | case SIOCINQ: |
@@ -1236,8 +1237,8 @@ static void raw6_sock_seq_show(struct seq_file *seq, struct sock *sp, int i) | |||
1236 | dest->s6_addr32[0], dest->s6_addr32[1], | 1237 | dest->s6_addr32[0], dest->s6_addr32[1], |
1237 | dest->s6_addr32[2], dest->s6_addr32[3], destp, | 1238 | dest->s6_addr32[2], dest->s6_addr32[3], destp, |
1238 | sp->sk_state, | 1239 | sp->sk_state, |
1239 | atomic_read(&sp->sk_wmem_alloc), | 1240 | sk_wmem_alloc_get(sp), |
1240 | atomic_read(&sp->sk_rmem_alloc), | 1241 | sk_rmem_alloc_get(sp), |
1241 | 0, 0L, 0, | 1242 | 0, 0L, 0, |
1242 | sock_i_uid(sp), 0, | 1243 | sock_i_uid(sp), 0, |
1243 | sock_i_ino(sp), | 1244 | sock_i_ino(sp), |
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c index fc333d854728..023beda6b224 100644 --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c | |||
@@ -1061,8 +1061,8 @@ static void udp6_sock_seq_show(struct seq_file *seq, struct sock *sp, int bucket | |||
1061 | dest->s6_addr32[0], dest->s6_addr32[1], | 1061 | dest->s6_addr32[0], dest->s6_addr32[1], |
1062 | dest->s6_addr32[2], dest->s6_addr32[3], destp, | 1062 | dest->s6_addr32[2], dest->s6_addr32[3], destp, |
1063 | sp->sk_state, | 1063 | sp->sk_state, |
1064 | atomic_read(&sp->sk_wmem_alloc), | 1064 | sk_wmem_alloc_get(sp), |
1065 | atomic_read(&sp->sk_rmem_alloc), | 1065 | sk_rmem_alloc_get(sp), |
1066 | 0, 0L, 0, | 1066 | 0, 0L, 0, |
1067 | sock_i_uid(sp), 0, | 1067 | sock_i_uid(sp), 0, |
1068 | sock_i_ino(sp), | 1068 | sock_i_ino(sp), |
diff --git a/net/ipx/af_ipx.c b/net/ipx/af_ipx.c index 1627050e29fd..417b0e309495 100644 --- a/net/ipx/af_ipx.c +++ b/net/ipx/af_ipx.c | |||
@@ -1835,7 +1835,7 @@ static int ipx_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) | |||
1835 | 1835 | ||
1836 | switch (cmd) { | 1836 | switch (cmd) { |
1837 | case TIOCOUTQ: | 1837 | case TIOCOUTQ: |
1838 | amount = sk->sk_sndbuf - atomic_read(&sk->sk_wmem_alloc); | 1838 | amount = sk->sk_sndbuf - sk_wmem_alloc_get(sk); |
1839 | if (amount < 0) | 1839 | if (amount < 0) |
1840 | amount = 0; | 1840 | amount = 0; |
1841 | rc = put_user(amount, (int __user *)argp); | 1841 | rc = put_user(amount, (int __user *)argp); |
diff --git a/net/ipx/ipx_proc.c b/net/ipx/ipx_proc.c index 5ed97ad0e2e3..576178482f89 100644 --- a/net/ipx/ipx_proc.c +++ b/net/ipx/ipx_proc.c | |||
@@ -280,8 +280,8 @@ static int ipx_seq_socket_show(struct seq_file *seq, void *v) | |||
280 | } | 280 | } |
281 | 281 | ||
282 | seq_printf(seq, "%08X %08X %02X %03d\n", | 282 | seq_printf(seq, "%08X %08X %02X %03d\n", |
283 | atomic_read(&s->sk_wmem_alloc), | 283 | sk_wmem_alloc_get(s), |
284 | atomic_read(&s->sk_rmem_alloc), | 284 | sk_rmem_alloc_get(s), |
285 | s->sk_state, SOCK_INODE(s->sk_socket)->i_uid); | 285 | s->sk_state, SOCK_INODE(s->sk_socket)->i_uid); |
286 | out: | 286 | out: |
287 | return 0; | 287 | return 0; |
diff --git a/net/irda/af_irda.c b/net/irda/af_irda.c index 3eb5bcc75f99..5922febe25c4 100644 --- a/net/irda/af_irda.c +++ b/net/irda/af_irda.c | |||
@@ -1762,7 +1762,8 @@ static int irda_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) | |||
1762 | switch (cmd) { | 1762 | switch (cmd) { |
1763 | case TIOCOUTQ: { | 1763 | case TIOCOUTQ: { |
1764 | long amount; | 1764 | long amount; |
1765 | amount = sk->sk_sndbuf - atomic_read(&sk->sk_wmem_alloc); | 1765 | |
1766 | amount = sk->sk_sndbuf - sk_wmem_alloc_get(sk); | ||
1766 | if (amount < 0) | 1767 | if (amount < 0) |
1767 | amount = 0; | 1768 | amount = 0; |
1768 | if (put_user(amount, (unsigned int __user *)arg)) | 1769 | if (put_user(amount, (unsigned int __user *)arg)) |
diff --git a/net/key/af_key.c b/net/key/af_key.c index 643c1be2d02e..dba9abd27f90 100644 --- a/net/key/af_key.c +++ b/net/key/af_key.c | |||
@@ -3662,8 +3662,8 @@ static int pfkey_seq_show(struct seq_file *f, void *v) | |||
3662 | seq_printf(f ,"%p %-6d %-6u %-6u %-6u %-6lu\n", | 3662 | seq_printf(f ,"%p %-6d %-6u %-6u %-6u %-6lu\n", |
3663 | s, | 3663 | s, |
3664 | atomic_read(&s->sk_refcnt), | 3664 | atomic_read(&s->sk_refcnt), |
3665 | atomic_read(&s->sk_rmem_alloc), | 3665 | sk_rmem_alloc_get(s), |
3666 | atomic_read(&s->sk_wmem_alloc), | 3666 | sk_wmem_alloc_get(s), |
3667 | sock_i_uid(s), | 3667 | sock_i_uid(s), |
3668 | sock_i_ino(s) | 3668 | sock_i_ino(s) |
3669 | ); | 3669 | ); |
diff --git a/net/llc/llc_proc.c b/net/llc/llc_proc.c index d208b3396d94..f97be471fe2e 100644 --- a/net/llc/llc_proc.c +++ b/net/llc/llc_proc.c | |||
@@ -134,8 +134,8 @@ static int llc_seq_socket_show(struct seq_file *seq, void *v) | |||
134 | seq_printf(seq, "@%02X ", llc->sap->laddr.lsap); | 134 | seq_printf(seq, "@%02X ", llc->sap->laddr.lsap); |
135 | llc_ui_format_mac(seq, llc->daddr.mac); | 135 | llc_ui_format_mac(seq, llc->daddr.mac); |
136 | seq_printf(seq, "@%02X %8d %8d %2d %3d %4d\n", llc->daddr.lsap, | 136 | seq_printf(seq, "@%02X %8d %8d %2d %3d %4d\n", llc->daddr.lsap, |
137 | atomic_read(&sk->sk_wmem_alloc), | 137 | sk_wmem_alloc_get(sk), |
138 | atomic_read(&sk->sk_rmem_alloc) - llc->copied_seq, | 138 | sk_rmem_alloc_get(sk) - llc->copied_seq, |
139 | sk->sk_state, | 139 | sk->sk_state, |
140 | sk->sk_socket ? SOCK_INODE(sk->sk_socket)->i_uid : -1, | 140 | sk->sk_socket ? SOCK_INODE(sk->sk_socket)->i_uid : -1, |
141 | llc->link); | 141 | llc->link); |
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index 8b6bbb3032b0..2936fa3b6dc8 100644 --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c | |||
@@ -1914,8 +1914,8 @@ static int netlink_seq_show(struct seq_file *seq, void *v) | |||
1914 | s->sk_protocol, | 1914 | s->sk_protocol, |
1915 | nlk->pid, | 1915 | nlk->pid, |
1916 | nlk->groups ? (u32)nlk->groups[0] : 0, | 1916 | nlk->groups ? (u32)nlk->groups[0] : 0, |
1917 | atomic_read(&s->sk_rmem_alloc), | 1917 | sk_rmem_alloc_get(s), |
1918 | atomic_read(&s->sk_wmem_alloc), | 1918 | sk_wmem_alloc_get(s), |
1919 | nlk->cb, | 1919 | nlk->cb, |
1920 | atomic_read(&s->sk_refcnt), | 1920 | atomic_read(&s->sk_refcnt), |
1921 | atomic_read(&s->sk_drops) | 1921 | atomic_read(&s->sk_drops) |
diff --git a/net/netrom/af_netrom.c b/net/netrom/af_netrom.c index cd911904cbe1..ce51ce012cda 100644 --- a/net/netrom/af_netrom.c +++ b/net/netrom/af_netrom.c | |||
@@ -1205,7 +1205,7 @@ static int nr_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) | |||
1205 | long amount; | 1205 | long amount; |
1206 | 1206 | ||
1207 | lock_sock(sk); | 1207 | lock_sock(sk); |
1208 | amount = sk->sk_sndbuf - atomic_read(&sk->sk_wmem_alloc); | 1208 | amount = sk->sk_sndbuf - sk_wmem_alloc_get(sk); |
1209 | if (amount < 0) | 1209 | if (amount < 0) |
1210 | amount = 0; | 1210 | amount = 0; |
1211 | release_sock(sk); | 1211 | release_sock(sk); |
@@ -1341,8 +1341,8 @@ static int nr_info_show(struct seq_file *seq, void *v) | |||
1341 | nr->n2count, | 1341 | nr->n2count, |
1342 | nr->n2, | 1342 | nr->n2, |
1343 | nr->window, | 1343 | nr->window, |
1344 | atomic_read(&s->sk_wmem_alloc), | 1344 | sk_wmem_alloc_get(s), |
1345 | atomic_read(&s->sk_rmem_alloc), | 1345 | sk_rmem_alloc_get(s), |
1346 | s->sk_socket ? SOCK_INODE(s->sk_socket)->i_ino : 0L); | 1346 | s->sk_socket ? SOCK_INODE(s->sk_socket)->i_ino : 0L); |
1347 | 1347 | ||
1348 | bh_unlock_sock(s); | 1348 | bh_unlock_sock(s); |
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index 4f76e5552d8e..ebe5718baa31 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c | |||
@@ -1987,7 +1987,8 @@ static int packet_ioctl(struct socket *sock, unsigned int cmd, | |||
1987 | switch (cmd) { | 1987 | switch (cmd) { |
1988 | case SIOCOUTQ: | 1988 | case SIOCOUTQ: |
1989 | { | 1989 | { |
1990 | int amount = atomic_read(&sk->sk_wmem_alloc); | 1990 | int amount = sk_wmem_alloc_get(sk); |
1991 | |||
1991 | return put_user(amount, (int __user *)arg); | 1992 | return put_user(amount, (int __user *)arg); |
1992 | } | 1993 | } |
1993 | case SIOCINQ: | 1994 | case SIOCINQ: |
diff --git a/net/rose/af_rose.c b/net/rose/af_rose.c index 4dd9a7d18945..6bd8e93869ed 100644 --- a/net/rose/af_rose.c +++ b/net/rose/af_rose.c | |||
@@ -1309,7 +1309,8 @@ static int rose_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) | |||
1309 | switch (cmd) { | 1309 | switch (cmd) { |
1310 | case TIOCOUTQ: { | 1310 | case TIOCOUTQ: { |
1311 | long amount; | 1311 | long amount; |
1312 | amount = sk->sk_sndbuf - atomic_read(&sk->sk_wmem_alloc); | 1312 | |
1313 | amount = sk->sk_sndbuf - sk_wmem_alloc_get(sk); | ||
1313 | if (amount < 0) | 1314 | if (amount < 0) |
1314 | amount = 0; | 1315 | amount = 0; |
1315 | return put_user(amount, (unsigned int __user *) argp); | 1316 | return put_user(amount, (unsigned int __user *) argp); |
@@ -1480,8 +1481,8 @@ static int rose_info_show(struct seq_file *seq, void *v) | |||
1480 | rose->hb / HZ, | 1481 | rose->hb / HZ, |
1481 | ax25_display_timer(&rose->idletimer) / (60 * HZ), | 1482 | ax25_display_timer(&rose->idletimer) / (60 * HZ), |
1482 | rose->idle / (60 * HZ), | 1483 | rose->idle / (60 * HZ), |
1483 | atomic_read(&s->sk_wmem_alloc), | 1484 | sk_wmem_alloc_get(s), |
1484 | atomic_read(&s->sk_rmem_alloc), | 1485 | sk_rmem_alloc_get(s), |
1485 | s->sk_socket ? SOCK_INODE(s->sk_socket)->i_ino : 0L); | 1486 | s->sk_socket ? SOCK_INODE(s->sk_socket)->i_ino : 0L); |
1486 | } | 1487 | } |
1487 | 1488 | ||
diff --git a/net/sched/em_meta.c b/net/sched/em_meta.c index 266151ae85a3..18d85d259104 100644 --- a/net/sched/em_meta.c +++ b/net/sched/em_meta.c | |||
@@ -349,13 +349,13 @@ META_COLLECTOR(int_sk_type) | |||
349 | META_COLLECTOR(int_sk_rmem_alloc) | 349 | META_COLLECTOR(int_sk_rmem_alloc) |
350 | { | 350 | { |
351 | SKIP_NONLOCAL(skb); | 351 | SKIP_NONLOCAL(skb); |
352 | dst->value = atomic_read(&skb->sk->sk_rmem_alloc); | 352 | dst->value = sk_rmem_alloc_get(skb->sk); |
353 | } | 353 | } |
354 | 354 | ||
355 | META_COLLECTOR(int_sk_wmem_alloc) | 355 | META_COLLECTOR(int_sk_wmem_alloc) |
356 | { | 356 | { |
357 | SKIP_NONLOCAL(skb); | 357 | SKIP_NONLOCAL(skb); |
358 | dst->value = atomic_read(&skb->sk->sk_wmem_alloc); | 358 | dst->value = sk_wmem_alloc_get(skb->sk); |
359 | } | 359 | } |
360 | 360 | ||
361 | META_COLLECTOR(int_sk_omem_alloc) | 361 | META_COLLECTOR(int_sk_omem_alloc) |
diff --git a/net/sctp/socket.c b/net/sctp/socket.c index 0f01e5d8a24f..35ba035970a2 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c | |||
@@ -130,7 +130,7 @@ static inline int sctp_wspace(struct sctp_association *asoc) | |||
130 | if (asoc->ep->sndbuf_policy) | 130 | if (asoc->ep->sndbuf_policy) |
131 | amt = asoc->sndbuf_used; | 131 | amt = asoc->sndbuf_used; |
132 | else | 132 | else |
133 | amt = atomic_read(&asoc->base.sk->sk_wmem_alloc); | 133 | amt = sk_wmem_alloc_get(asoc->base.sk); |
134 | 134 | ||
135 | if (amt >= asoc->base.sk->sk_sndbuf) { | 135 | if (amt >= asoc->base.sk->sk_sndbuf) { |
136 | if (asoc->base.sk->sk_userlocks & SOCK_SNDBUF_LOCK) | 136 | if (asoc->base.sk->sk_userlocks & SOCK_SNDBUF_LOCK) |
@@ -6523,7 +6523,7 @@ static int sctp_writeable(struct sock *sk) | |||
6523 | { | 6523 | { |
6524 | int amt = 0; | 6524 | int amt = 0; |
6525 | 6525 | ||
6526 | amt = sk->sk_sndbuf - atomic_read(&sk->sk_wmem_alloc); | 6526 | amt = sk->sk_sndbuf - sk_wmem_alloc_get(sk); |
6527 | if (amt < 0) | 6527 | if (amt < 0) |
6528 | amt = 0; | 6528 | amt = 0; |
6529 | return amt; | 6529 | return amt; |
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index 9dcc6e7f96ec..36d4e44d6233 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c | |||
@@ -1946,7 +1946,7 @@ static int unix_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) | |||
1946 | 1946 | ||
1947 | switch (cmd) { | 1947 | switch (cmd) { |
1948 | case SIOCOUTQ: | 1948 | case SIOCOUTQ: |
1949 | amount = atomic_read(&sk->sk_wmem_alloc); | 1949 | amount = sk_wmem_alloc_get(sk); |
1950 | err = put_user(amount, (int __user *)arg); | 1950 | err = put_user(amount, (int __user *)arg); |
1951 | break; | 1951 | break; |
1952 | case SIOCINQ: | 1952 | case SIOCINQ: |
diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c index 8cd2390b0d45..21cdc872004e 100644 --- a/net/x25/af_x25.c +++ b/net/x25/af_x25.c | |||
@@ -1271,8 +1271,8 @@ static int x25_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) | |||
1271 | 1271 | ||
1272 | switch (cmd) { | 1272 | switch (cmd) { |
1273 | case TIOCOUTQ: { | 1273 | case TIOCOUTQ: { |
1274 | int amount = sk->sk_sndbuf - | 1274 | int amount = sk->sk_sndbuf - sk_wmem_alloc_get(sk); |
1275 | atomic_read(&sk->sk_wmem_alloc); | 1275 | |
1276 | if (amount < 0) | 1276 | if (amount < 0) |
1277 | amount = 0; | 1277 | amount = 0; |
1278 | rc = put_user(amount, (unsigned int __user *)argp); | 1278 | rc = put_user(amount, (unsigned int __user *)argp); |
diff --git a/net/x25/x25_proc.c b/net/x25/x25_proc.c index 1afa44d25beb..0a04e62e0e18 100644 --- a/net/x25/x25_proc.c +++ b/net/x25/x25_proc.c | |||
@@ -163,8 +163,8 @@ static int x25_seq_socket_show(struct seq_file *seq, void *v) | |||
163 | devname, x25->lci & 0x0FFF, x25->state, x25->vs, x25->vr, | 163 | devname, x25->lci & 0x0FFF, x25->state, x25->vs, x25->vr, |
164 | x25->va, x25_display_timer(s) / HZ, x25->t2 / HZ, | 164 | x25->va, x25_display_timer(s) / HZ, x25->t2 / HZ, |
165 | x25->t21 / HZ, x25->t22 / HZ, x25->t23 / HZ, | 165 | x25->t21 / HZ, x25->t22 / HZ, x25->t23 / HZ, |
166 | atomic_read(&s->sk_wmem_alloc), | 166 | sk_wmem_alloc_get(s), |
167 | atomic_read(&s->sk_rmem_alloc), | 167 | sk_rmem_alloc_get(s), |
168 | s->sk_socket ? SOCK_INODE(s->sk_socket)->i_ino : 0L); | 168 | s->sk_socket ? SOCK_INODE(s->sk_socket)->i_ino : 0L); |
169 | out: | 169 | out: |
170 | return 0; | 170 | return 0; |