From: Stephen Hemminger <stephen@networkplumber.org> Date: 2018-02-24 19:05:03
This fixes an old bug in iproute2's ss command because it was
reading slabinfo to get statistics. There isn't a better API
to do this, and one can argue that /proc is a UAPI that must
not change.
Therefore this patch set adds a flag to slab to give another
reason to prevent merging, and then uses it in network code.
The patches are against davem's linux-net tree and should also
goto stable as well.
Stephen Hemminger (2):
slab: add flag to block merging of UAPI elements
net: mark slab's used by ss as UAPI
include/linux/slab.h | 6 ++++++
mm/slab_common.c | 2 +-
net/ipv4/tcp.c | 3 ++-
net/ipv4/tcp_ipv4.c | 2 +-
net/ipv6/tcp_ipv6.c | 2 +-
net/socket.c | 6 +++---
6 files changed, 14 insertions(+), 7 deletions(-)
--
2.16.1
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
From: Stephen Hemminger <stephen@networkplumber.org> Date: 2018-02-24 19:05:04
The iproute2 program ss reads /proc/slabinfo to get TCP socket
statistics; therefore those kmem cache's can not be merged.
This patch adds a new flag to block merging in these kind
of cases.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
include/linux/slab.h | 6 ++++++
mm/slab_common.c | 2 +-
2 files changed, 7 insertions(+), 1 deletion(-)
--
2.16.1
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
From: Stephen Hemminger <stephen@networkplumber.org> Date: 2018-02-24 19:05:06
The iproute2 ss command reads /proc/slabinfo as way to get estimates
for number of open sockets etc. This has been broken since slab
merging went in 3.17.
Mark those kmem caches's as non mergeable with new flag.
The TCP caches's are already not mergeable because of the RCU
flags, but someone might change that and cause surprise later.
Reported-by: Igor Komyagin <redacted>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
net/ipv4/tcp.c | 3 ++-
net/ipv4/tcp_ipv4.c | 2 +-
net/ipv6/tcp_ipv6.c | 2 +-
net/socket.c | 6 +++---
4 files changed, 7 insertions(+), 6 deletions(-)
@@ -3617,7 +3617,8 @@ void __init tcp_init(void)tcp_hashinfo.bind_bucket_cachep=kmem_cache_create("tcp_bind_bucket",sizeof(structinet_bind_bucket),0,-SLAB_HWCACHE_ALIGN|SLAB_PANIC,NULL);+SLAB_HWCACHE_ALIGN|SLAB_PANIC|SLAB_VISIBLE_UAPI,+NULL);/* Size and allocate the main established and bind bucket*hashtables.
--
2.16.1
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
From: Matthew Wilcox <willy@infradead.org> Date: 2018-02-24 21:05:19
On Sat, Feb 24, 2018 at 11:04:52AM -0800, Stephen Hemminger wrote:
This fixes an old bug in iproute2's ss command because it was
reading slabinfo to get statistics. There isn't a better API
to do this, and one can argue that /proc is a UAPI that must
not change.
Therefore this patch set adds a flag to slab to give another
reason to prevent merging, and then uses it in network code.
This is exactly the solution I would have suggested. Note that SLUB
has always had slab merging, so this tool has been broken since 2.6.22
on any kernel with CONFIG_SLUB.
Reviewed-by: Matthew Wilcox <redacted>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
From: Stephen Hemminger <stephen@networkplumber.org> Date: 2018-02-25 16:36:48
On Sat, 24 Feb 2018 11:04:52 -0800
Stephen Hemminger [off-list ref] wrote:
This fixes an old bug in iproute2's ss command because it was
reading slabinfo to get statistics. There isn't a better API
to do this, and one can argue that /proc is a UAPI that must
not change.
Therefore this patch set adds a flag to slab to give another
reason to prevent merging, and then uses it in network code.
The patches are against davem's linux-net tree and should also
goto stable as well.
Stephen Hemminger (2):
slab: add flag to block merging of UAPI elements
net: mark slab's used by ss as UAPI
include/linux/slab.h | 6 ++++++
mm/slab_common.c | 2 +-
net/ipv4/tcp.c | 3 ++-
net/ipv4/tcp_ipv4.c | 2 +-
net/ipv6/tcp_ipv6.c | 2 +-
net/socket.c | 6 +++---
6 files changed, 14 insertions(+), 7 deletions(-)
The kbuild reports need more root cause investigation before applying.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
From: David Miller <hidden> Date: 2018-02-26 20:15:04
From: Stephen Hemminger <stephen@networkplumber.org>
Date: Sat, 24 Feb 2018 11:04:52 -0800
This fixes an old bug in iproute2's ss command because it was
reading slabinfo to get statistics. There isn't a better API
to do this, and one can argue that /proc is a UAPI that must
not change.
Please elaborate what kind of statistics are needed.
Therefore this patch set adds a flag to slab to give another
reason to prevent merging, and then uses it in network code.
The patches are against davem's linux-net tree and should also
goto stable as well.
Well, as has been pointed out this never worked with SLUB so
in some sense this was always broken.
And the "UAPI" of slabinfo is to show the state of the various
slab caches. And that's it.
If the implementation does merging or whatever, the UAPI is expressing
that and it's perfectly legitimate and not breaking UAPI in my
opinion.
I think the better solution is to grab the information from somewhere
else, so let's move this conversation along with the answer to my
question about asking for more details about what is needed by
iproute2.
Thank you.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
From: Stephen Hemminger <stephen@networkplumber.org> Date: 2018-02-26 21:46:22
On Mon, 26 Feb 2018 15:15:02 -0500 (EST)
David Miller [off-list ref] wrote:
From: Stephen Hemminger <stephen@networkplumber.org>
Date: Sat, 24 Feb 2018 11:04:52 -0800
quoted
This fixes an old bug in iproute2's ss command because it was
reading slabinfo to get statistics. There isn't a better API
to do this, and one can argue that /proc is a UAPI that must
not change.
Please elaborate what kind of statistics are needed.
This is ancient original iproute2 code that dumpster dives into
slabinfo to get summary statistics on active objects.
1) open sockets (sock_inode_cache)
2) TCP ports bound (tcp_bind_buckets) [*]
3) TCP time wait sockets (tw_sock_TCP) [*]
4) TCP syn sockets (request_sock_TCP) [*]
From man page:
-s, --summary
Print summary statistics. This option does not parse socket lists obtaining summary from
various sources. It is useful when amount of sockets is so huge that parsing /proc/net/tcp
is painful.
The items with * are currently broken. See 0 for timewait, synrecv, and ports.
$ sudo ss -s
Total: 1089 (kernel 1093)
TCP: 33 (estab 4, closed 1, orphaned 0, synrecv 0, timewait 0/0), ports 0
Transport Total IP IPv6
* 1093 - -
RAW 0 0 0
UDP 21 13 8
TCP 32 24 8
INET 53 37 16
FRAG 0 0 0
quoted
Therefore this patch set adds a flag to slab to give another
reason to prevent merging, and then uses it in network code.
The patches are against davem's linux-net tree and should also
goto stable as well.
Well, as has been pointed out this never worked with SLUB so
in some sense this was always broken.
And the "UAPI" of slabinfo is to show the state of the various
slab caches. And that's it.
If the implementation does merging or whatever, the UAPI is expressing
that and it's perfectly legitimate and not breaking UAPI in my
opinion.
I think the better solution is to grab the information from somewhere
else, so let's move this conversation along with the answer to my
question about asking for more details about what is needed by
iproute2.
Thank you.
There is no where else that gives summary information.
Both /proc/net/tcp and sock diag info require user space to
read all the data, which is what I think Alexey was trying to avoid.
Ideally there would be network namespace aware API to do this, but
the code (iproute2 and kernel) are currently broken. Some values
are missing (because they are merged) and some values have wrong
cache name (because of acme's changes to make this generic).
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
From: David Miller <davem@davemloft.net> Date: 2018-02-27 01:13:59
From: Stephen Hemminger <stephen@networkplumber.org>
Date: Mon, 26 Feb 2018 13:46:13 -0800
This is ancient original iproute2 code that dumpster dives into
slabinfo to get summary statistics on active objects.
1) open sockets (sock_inode_cache)
The sockets inuse counter from /proc/net/sockstat is really
sufficient for this.
Time wait is provided by /proc/net/sockstat as well.
4) TCP syn sockets (request_sock_TCP) [*]
It shouldn't be too hard to fill in the last two gaps, maintaining a
counter for bind buckets and request socks, and exporting them in new
/proc/net/sockstat field.
That would be so much better than disabling a useful optimization
in the SLAB allocator.
Thank you.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>