netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] IPVS: logging sizeof(struct ip_vs_conn) on startup
@ 2009-07-27  9:08 Hannes Eder
  2009-07-27  9:22 ` Simon Horman
  2009-07-27  9:25 ` Eric Dumazet
  0 siblings, 2 replies; 8+ messages in thread
From: Hannes Eder @ 2009-07-27  9:08 UTC (permalink / raw)
  To: netdev; +Cc: lvs-users, malcolm, linux-kernel

No more guessing, how much memory is used by IPVS for a connection.

Signed-off-by: Hannes Eder <heder@google.com>
---
 net/netfilter/ipvs/ip_vs_core.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/net/netfilter/ipvs/ip_vs_core.c b/net/netfilter/ipvs/ip_vs_core.c
index b021464..5b0997c 100644
--- a/net/netfilter/ipvs/ip_vs_core.c
+++ b/net/netfilter/ipvs/ip_vs_core.c
@@ -1475,7 +1475,8 @@ static int __init ip_vs_init(void)
 		goto cleanup_conn;
 	}
 
-	IP_VS_INFO("ipvs loaded.\n");
+	IP_VS_INFO("ipvs loaded (using %Zd bytes/connection).\n",
+	       sizeof(struct ip_vs_conn));
 	return ret;
 
   cleanup_conn:


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

* Re: [PATCH] IPVS: logging sizeof(struct ip_vs_conn) on startup
  2009-07-27  9:08 [PATCH] IPVS: logging sizeof(struct ip_vs_conn) on startup Hannes Eder
@ 2009-07-27  9:22 ` Simon Horman
  2009-07-27  9:25 ` Eric Dumazet
  1 sibling, 0 replies; 8+ messages in thread
From: Simon Horman @ 2009-07-27  9:22 UTC (permalink / raw)
  To: Hannes Eder; +Cc: netdev, lvs-users, malcolm, linux-kernel, David Miller

On Mon, Jul 27, 2009 at 11:08:34AM +0200, Hannes Eder wrote:
> No more guessing, how much memory is used by IPVS for a connection.

I like that.

> Signed-off-by: Hannes Eder <heder@google.com>

Signed-off-by: Simon Horman <horms@verge.net.au>

> ---
>  net/netfilter/ipvs/ip_vs_core.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/net/netfilter/ipvs/ip_vs_core.c b/net/netfilter/ipvs/ip_vs_core.c
> index b021464..5b0997c 100644
> --- a/net/netfilter/ipvs/ip_vs_core.c
> +++ b/net/netfilter/ipvs/ip_vs_core.c
> @@ -1475,7 +1475,8 @@ static int __init ip_vs_init(void)
>  		goto cleanup_conn;
>  	}
>  
> -	IP_VS_INFO("ipvs loaded.\n");
> +	IP_VS_INFO("ipvs loaded (using %Zd bytes/connection).\n",
> +	       sizeof(struct ip_vs_conn));
>  	return ret;
>  
>    cleanup_conn:
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

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

* Re: [PATCH] IPVS: logging sizeof(struct ip_vs_conn) on startup
  2009-07-27  9:08 [PATCH] IPVS: logging sizeof(struct ip_vs_conn) on startup Hannes Eder
  2009-07-27  9:22 ` Simon Horman
@ 2009-07-27  9:25 ` Eric Dumazet
  2009-07-27 10:34   ` Hannes Eder
  1 sibling, 1 reply; 8+ messages in thread
From: Eric Dumazet @ 2009-07-27  9:25 UTC (permalink / raw)
  To: Hannes Eder; +Cc: netdev, lvs-users, malcolm, linux-kernel

Hannes Eder a écrit :
> No more guessing, how much memory is used by IPVS for a connection.
> 
> Signed-off-by: Hannes Eder <heder@google.com>
> ---
>  net/netfilter/ipvs/ip_vs_core.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/net/netfilter/ipvs/ip_vs_core.c b/net/netfilter/ipvs/ip_vs_core.c
> index b021464..5b0997c 100644
> --- a/net/netfilter/ipvs/ip_vs_core.c
> +++ b/net/netfilter/ipvs/ip_vs_core.c
> @@ -1475,7 +1475,8 @@ static int __init ip_vs_init(void)
>  		goto cleanup_conn;
>  	}
>  
> -	IP_VS_INFO("ipvs loaded.\n");
> +	IP_VS_INFO("ipvs loaded (using %Zd bytes/connection).\n",
> +	       sizeof(struct ip_vs_conn));
>  	return ret;
>  
>    cleanup_conn:

Well, ip_vs_conn_cache uses SLAB_HWCACHE_ALIGN, so this should be rounded up
to L1 cache size. Or add "at least" like in line 1080
of net/netfilter/ipvs/ip_vs_conn.c :

	IP_VS_DBG(0, "Each connection entry needs %Zd bytes at least\n",
		  sizeof(struct ip_vs_conn));

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

* Re: [PATCH] IPVS: logging sizeof(struct ip_vs_conn) on startup
  2009-07-27  9:25 ` Eric Dumazet
@ 2009-07-27 10:34   ` Hannes Eder
  2009-07-27 13:13     ` [PATCH v2] " Hannes Eder
  0 siblings, 1 reply; 8+ messages in thread
From: Hannes Eder @ 2009-07-27 10:34 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: netdev, lvs-users, malcolm, linux-kernel, David Miller,
	Simon Horman

On Mon, Jul 27, 2009 at 11:25, Eric Dumazet<eric.dumazet@gmail.com> wrote:
> Well, ip_vs_conn_cache uses SLAB_HWCACHE_ALIGN, so this should be rounded up
> to L1 cache size. Or add "at least" like in line 1080
> of net/netfilter/ipvs/ip_vs_conn.c :
>
> IP_VS_DBG(0, "Each connection entry needs %Zd bytes at least\n",
>           sizeof(struct ip_vs_conn));

Good point.  Is there an easy way to figure out how much memory is
wasted for alignment by the slab allocator?  Otherwise I vote for the
"at least" approach.

-Hannes

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

* [PATCH v2] IPVS: logging sizeof(struct ip_vs_conn) on startup
  2009-07-27 10:34   ` Hannes Eder
@ 2009-07-27 13:13     ` Hannes Eder
  2009-07-27 18:48       ` David Miller
  0 siblings, 1 reply; 8+ messages in thread
From: Hannes Eder @ 2009-07-27 13:13 UTC (permalink / raw)
  To: netdev; +Cc: Eric Dumazet, lvs-users, malcolm, linux-kernel, Simon Horman

No more guessing, how much memory used by IPVS for a connection.

[ The number printed is a lower bound, as ip_vs_conn_cache uses
SLAB_HWCACHE_ALIGN. ]

Signed-off-by: Hannes Eder <heder@google.com>
Signed-off-by: Simon Horman <horms@verge.net.au>

 net/netfilter/ipvs/ip_vs_core.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/net/netfilter/ipvs/ip_vs_core.c b/net/netfilter/ipvs/ip_vs_core.c
index b021464..b6bb4a0 100644
--- a/net/netfilter/ipvs/ip_vs_core.c
+++ b/net/netfilter/ipvs/ip_vs_core.c
@@ -1475,7 +1475,8 @@ static int __init ip_vs_init(void)
 		goto cleanup_conn;
 	}
 
-	IP_VS_INFO("ipvs loaded.\n");
+	IP_VS_INFO("ipvs loaded (using at least %Zd bytes/connection).\n",
+	       sizeof(struct ip_vs_conn));
 	return ret;
 
   cleanup_conn:


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

* Re: [PATCH v2] IPVS: logging sizeof(struct ip_vs_conn) on startup
  2009-07-27 13:13     ` [PATCH v2] " Hannes Eder
@ 2009-07-27 18:48       ` David Miller
  2009-07-28  0:19         ` Simon Horman
  0 siblings, 1 reply; 8+ messages in thread
From: David Miller @ 2009-07-27 18:48 UTC (permalink / raw)
  To: heder; +Cc: netdev, eric.dumazet, lvs-users, malcolm, linux-kernel, horms

From: Hannes Eder <heder@google.com>
Date: Mon, 27 Jul 2009 15:13:57 +0200

> No more guessing, how much memory used by IPVS for a connection.
> 
> [ The number printed is a lower bound, as ip_vs_conn_cache uses
> SLAB_HWCACHE_ALIGN. ]
> 
> Signed-off-by: Hannes Eder <heder@google.com>
> Signed-off-by: Simon Horman <horms@verge.net.au>

Who needs to know this?  A developer?

They can run tools such as 'pahole' et al. to fish out this
information even when only a kernel binary is available.

For the user, it's just noise.

I'm not applying this, sorry.

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

* Re: [PATCH v2] IPVS: logging sizeof(struct ip_vs_conn) on startup
  2009-07-27 18:48       ` David Miller
@ 2009-07-28  0:19         ` Simon Horman
  2009-07-28  5:38           ` Eric Dumazet
  0 siblings, 1 reply; 8+ messages in thread
From: Simon Horman @ 2009-07-28  0:19 UTC (permalink / raw)
  To: David Miller
  Cc: heder, netdev, eric.dumazet, lvs-users, malcolm, linux-kernel

On Mon, Jul 27, 2009 at 11:48:45AM -0700, David Miller wrote:
> From: Hannes Eder <heder@google.com>
> Date: Mon, 27 Jul 2009 15:13:57 +0200
> 
> > No more guessing, how much memory used by IPVS for a connection.
> > 
> > [ The number printed is a lower bound, as ip_vs_conn_cache uses
> > SLAB_HWCACHE_ALIGN. ]
> > 
> > Signed-off-by: Hannes Eder <heder@google.com>
> > Signed-off-by: Simon Horman <horms@verge.net.au>
> 
> Who needs to know this?  A developer?
> 
> They can run tools such as 'pahole' et al. to fish out this
> information even when only a kernel binary is available.
> 
> For the user, it's just noise.
> 
> I'm not applying this, sorry.

Surprisingly its a very common question amongst users,
because they want to know how much memory they need.
It is of course all a bit silly, because the amount of
memory used by the connection table is usually very small,
but people still ask.

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

* Re: [PATCH v2] IPVS: logging sizeof(struct ip_vs_conn) on startup
  2009-07-28  0:19         ` Simon Horman
@ 2009-07-28  5:38           ` Eric Dumazet
  0 siblings, 0 replies; 8+ messages in thread
From: Eric Dumazet @ 2009-07-28  5:38 UTC (permalink / raw)
  To: Simon Horman
  Cc: David Miller, heder, netdev, lvs-users, malcolm, linux-kernel

Simon Horman a écrit :
> 
> Surprisingly its a very common question amongst users,
> because they want to know how much memory they need.
> It is of course all a bit silly, because the amount of
> memory used by the connection table is usually very small,
> but people still ask.
> 

If SLUB is used 

$ cat /sys/kernel/slab/ip_vs_conn/object_size

If SLAB is used, take fourth column of :

$ grep ip_vs_conn /proc/slabinfo

BTW these take into account L1 cache size alignment

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

end of thread, other threads:[~2009-07-28  5:39 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-27  9:08 [PATCH] IPVS: logging sizeof(struct ip_vs_conn) on startup Hannes Eder
2009-07-27  9:22 ` Simon Horman
2009-07-27  9:25 ` Eric Dumazet
2009-07-27 10:34   ` Hannes Eder
2009-07-27 13:13     ` [PATCH v2] " Hannes Eder
2009-07-27 18:48       ` David Miller
2009-07-28  0:19         ` Simon Horman
2009-07-28  5:38           ` Eric Dumazet

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