netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] NET : struct proto diet
@ 2007-11-05 17:52 Eric Dumazet
  2007-11-06  7:43 ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Dumazet @ 2007-11-05 17:52 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev

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 
infrastructure


Thank you
Eric




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

* Re: [PATCH 0/4] NET : struct proto diet
  2007-11-05 17:52 [PATCH 0/4] NET : struct proto diet Eric Dumazet
@ 2007-11-06  7:43 ` David Miller
  2007-11-07 16:16   ` [PATCH 0/2] generalize {DEFINE|REF}_PROTO_INUSE was " Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 3+ messages in thread
From: David Miller @ 2007-11-06  7:43 UTC (permalink / raw)
  To: dada1; +Cc: netdev

From: Eric Dumazet <dada1@cosmosbay.com>
Date: Mon, 05 Nov 2007 18:52:32 +0100

> 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.

>From 43d36c1ceff9ce1ed5a9ba87ea91a99f4f79ad00 Mon Sep 17 00:00:00 2001
From: David S. Miller <davem@sunset.davemloft.net>
Date: Mon, 5 Nov 2007 23:42:25 -0800
Subject: [PATCH] [DCCP]: Use DEFINE_PROTO_INUSE infrastructure.

Signed-off-by: David S. Miller <davem@davemloft.net>
---
 net/dccp/ipv4.c |    3 +++
 net/dccp/ipv6.c |    3 +++
 2 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c
index 01a6a80..db17b83 100644
--- a/net/dccp/ipv4.c
+++ b/net/dccp/ipv4.c
@@ -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 = {
diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c
index 62428ff..87c98fb 100644
--- a/net/dccp/ipv6.c
+++ b/net/dccp/ipv6.c
@@ -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 = {
-- 
1.5.3.5


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

* [PATCH 0/2] generalize {DEFINE|REF}_PROTO_INUSE was Re: [PATCH 0/4] NET : struct proto diet
  2007-11-06  7:43 ` David Miller
@ 2007-11-07 16:16   ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 3+ messages in thread
From: Arnaldo Carvalho de Melo @ 2007-11-07 16:16 UTC (permalink / raw)
  To: David Miller; +Cc: dada1, netdev

Em Mon, Nov 05, 2007 at 11:43:06PM -0800, David Miller escreveu:
> From: Eric Dumazet <dada1@cosmosbay.com>
> Date: Mon, 05 Nov 2007 18:52:32 +0100
> 
> > 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.

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

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

end of thread, other threads:[~2007-11-07 16:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-05 17:52 [PATCH 0/4] NET : struct proto diet Eric Dumazet
2007-11-06  7:43 ` David Miller
2007-11-07 16:16   ` [PATCH 0/2] generalize {DEFINE|REF}_PROTO_INUSE was " Arnaldo Carvalho de Melo

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).