NET : struct proto diet
Subsystems (2)
cover NET : struct proto diet
Hi
After reading David's machines have NR_CPUS set to 4096, I realized how fat was 'struct proto', since it uses a stats[NR_CPUS] field to keep track of inuse sockets per protocol.
With NR_CPUS = 4096, this means we allocate 4096*SMP_CACHE_BYTES bytes per 'struct proto'.
As these structures are static (data section of kernel), this grows data kernel section by 256 KB per protocol.
This patch series does some cleanup and optimization.
[PATCH 1/4] NET : defines an infrastructure to keep 'inuse' changes in an efficent SMP/NUMA way.
[PATCH 2/4] NET : makes ipv4 use the {DEFINE|REF}_PROTO_INUSE infrastructure
[PATCH 3/4] NET : makes ipv6 use the {DEFINE|REF}_PROTO_INUSE infrastructure
[PATCH 4/4] NET : makes sctp use the {DEFINE|REF}_PROTO_INUSE infrastructureThank you
Eric
From: Eric Dumazet <[email protected]>
Date: Mon, 05 Nov 2007 18:52:32 +0100
Quoted 10 lines
This patch series does some cleanup and optimization.
[PATCH 1/4] NET : defines an infrastructure to keep 'inuse' changes in an efficent SMP/NUMA way.
[PATCH 2/4] NET : makes ipv4 use the {DEFINE|REF}_PROTO_INUSE infrastructure
[PATCH 3/4] NET : makes ipv6 use the {DEFINE|REF}_PROTO_INUSE infrastructure
[PATCH 4/4] NET : makes sctp use the {DEFINE|REF}_PROTO_INUSE infrastructure
Applied, and because I love DCCP I added the following patch on top.
Quoted 1 line
From
43d36c1ceff9ce1ed5a9ba87ea91a99f4f79ad00Mon Sep 17 00:00:00 2001
From: David S. Miller <[email protected]>
Date: Mon, 5 Nov 2007 23:42:25 -0800
Subject: [PATCH] [DCCP]: Use DEFINE_PROTO_INUSE infrastructure.
--- net/dccp/ipv4.c | 3 +++ net/dccp/ipv6.c | 3 +++ 2 files changed, 6 insertions(+), 0 deletions(-)
net/dccp/ipv4.c +3 -0
@@ -922,6 +922,8 @@ static struct timewait_sock_ops dccp_timewait_sock_ops = { .twsk_obj_size = sizeof(struct inet_timewait_sock), }; +DEFINE_PROTO_INUSE (dccp_v4) + static struct proto dccp_v4_prot = { .name ="DCCP" , .owner =THIS_MODULE ,
@@ -950,6 +952,7 @@ static struct proto dccp_v4_prot = { .compat_setsockopt = compat_dccp_setsockopt, .compat_getsockopt = compat_dccp_getsockopt,#endif +REF_PROTO_INUSE (dccp_v4) };static struct net_protocol dccp_v4_protocol = {
net/dccp/ipv6.c +3 -0
@@ -1107,6 +1107,8 @@ static struct timewait_sock_ops dccp6_timewait_sock_ops = { .twsk_obj_size = sizeof(struct dccp6_timewait_sock), }; +DEFINE_PROTO_INUSE (dccp_v6) + static struct proto dccp_v6_prot = { .name ="DCCPv6" , .owner =THIS_MODULE ,
@@ -1135,6 +1137,7 @@ static struct proto dccp_v6_prot = { .compat_setsockopt = compat_dccp_setsockopt, .compat_getsockopt = compat_dccp_getsockopt,#endif +REF_PROTO_INUSE (dccp_v6) };static struct inet6_protocol dccp_v6_protocol = {
Signature · 1 line
1.5.3.5
cover generalize {DEFINE|REF}_PROTO_INUSE was Re: [PATCH 0/4] NET : struct proto diet
Em Mon, Nov 05, 2007 at 11:43:06PM -0800, David Miller escreveu:
Quoted 14 lines
From: Eric Dumazet <[email protected]>
Date: Mon, 05 Nov 2007 18:52:32 +0100Quoted 10 lines
This patch series does some cleanup and optimization.
[PATCH 1/4] NET : defines an infrastructure to keep 'inuse' changes in an efficent SMP/NUMA way.
[PATCH 2/4] NET : makes ipv4 use the {DEFINE|REF}_PROTO_INUSE infrastructure
[PATCH 3/4] NET : makes ipv6 use the {DEFINE|REF}_PROTO_INUSE infrastructure
[PATCH 4/4] NET : makes sctp use the {DEFINE|REF}_PROTO_INUSE infrastructure
Quoted 2 lines
Applied, and because I love DCCP I added the following patch on top.
Thank you dudes. I found it so nice that I can't help but wonder if this wouldn't provide for an interesting "class", because this has nothing that is specific to network protocols, struct proto is just one user...
Lemme try to do this right now:
David,
Please consider pulling from:
master.kernel.org:/pub/scm/linux/kernel/git/acme/net-2.6
- Arnaldo