public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] Only output msgmni value at boot time
       [not found] <20080527082441.239624000@bull.net>
@ 2008-05-27  8:24 ` Nadia.Derbey
  2008-05-27 16:52   ` Luck, Tony
  0 siblings, 1 reply; 3+ messages in thread
From: Nadia.Derbey @ 2008-05-27  8:24 UTC (permalink / raw)
  To: akpm; +Cc: tony.luck, linux-kernel, Nadia Derbey

[-- Attachment #1: fix_msgmni_printk.patch --]
[-- Type: text/plain, Size: 1931 bytes --]

Hi,

When posting:
[PATCH 1/8] Scaling msgmni to the amount of lowmem
(see http://lkml.org/lkml/2008/2/11/171), I have added a KERN_INFO message
that is output each time msgmni is recomputed.

In http://lkml.org/lkml/2008/4/29/575 Tony Luck complained that this message
references an ipc namespace address that is useless.

I first thought of using an audit_log instead of a printk, as suggested by
Serge Hallyn. But unfortunately, we do not have any other information than
the namespace address to provide here too.
So I chose to move the message and output it only at boot time, removing the
reference to the namespace.

This patch applies to 2.6.26-rc2-mm1.

Signed-off-by: Nadia Derbey <Nadia.Derbey@bull.net>

---
 ipc/msg.c |   13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

Index: linux-2.6.26-rc2-mm1/ipc/msg.c
===================================================================
--- linux-2.6.26-rc2-mm1.orig/ipc/msg.c	2008-05-26 12:25:37.000000000 +0200
+++ linux-2.6.26-rc2-mm1/ipc/msg.c	2008-05-27 10:59:34.000000000 +0200
@@ -98,20 +98,15 @@ void recompute_msgmni(struct ipc_namespa
 
 	if (allowed < MSGMNI) {
 		ns->msg_ctlmni = MSGMNI;
-		goto out_callback;
+		return;
 	}
 
 	if (allowed > IPCMNI / nb_ns) {
 		ns->msg_ctlmni = IPCMNI / nb_ns;
-		goto out_callback;
+		return;
 	}
 
 	ns->msg_ctlmni = allowed;
-
-out_callback:
-
-	printk(KERN_INFO "msgmni has been set to %d for ipc namespace %p\n",
-		ns->msg_ctlmni, ns);
 }
 
 void msg_init_ns(struct ipc_namespace *ns)
@@ -136,6 +131,10 @@ void msg_exit_ns(struct ipc_namespace *n
 void __init msg_init(void)
 {
 	msg_init_ns(&init_ipc_ns);
+
+	printk(KERN_INFO "msgmni has been set to %d\n",
+		init_ipc_ns.msg_ctlmni);
+
 	ipc_init_proc_interface("sysvipc/msg",
 				"       key      msqid perms      cbytes       qnum lspid lrpid   uid   gid  cuid  cgid      stime      rtime      ctime\n",
 				IPC_MSG_IDS, sysvipc_msg_proc_show);

--

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

* RE: [PATCH 1/1] Only output msgmni value at boot time
  2008-05-27  8:24 ` [PATCH 1/1] Only output msgmni value at boot time Nadia.Derbey
@ 2008-05-27 16:52   ` Luck, Tony
  2008-05-29  9:43     ` Nadia Derbey
  0 siblings, 1 reply; 3+ messages in thread
From: Luck, Tony @ 2008-05-27 16:52 UTC (permalink / raw)
  To: Nadia.Derbey, akpm; +Cc: linux-kernel

> In http://lkml.org/lkml/2008/4/29/575 Tony Luck complained that this message
> references an ipc namespace address that is useless.
>
> I first thought of using an audit_log instead of a printk, as suggested by
> Serge Hallyn. But unfortunately, we do not have any other information than
> the namespace address to provide here too.
> So I chose to move the message and output it only at boot time, removing the
> reference to the namespace.

Diffing my before/after dmesg(8) output:
< msgmni has been set to 7964 for ipc namespace a000000100a1ad58
---
> msgmni has been set to 7964

Much prettier.  Thank you.

I'll leave it to SGI to ponder whether it is correct to compute
msgmni based on a linear function of lowmem (their big systems can
have terabytes of memory, all of which is counted as lowmem).

> This patch applies to 2.6.26-rc2-mm1.

Acked-by: Tony Luck <tony.luck@intel.com>

Signed-off-by: Nadia Derbey <Nadia.Derbey@bull.net>

---
 ipc/msg.c |   13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

Index: linux-2.6.26-rc2-mm1/ipc/msg.c
===================================================================
--- linux-2.6.26-rc2-mm1.orig/ipc/msg.c	2008-05-26 12:25:37.000000000 +0200
+++ linux-2.6.26-rc2-mm1/ipc/msg.c	2008-05-27 10:59:34.000000000 +0200
@@ -98,20 +98,15 @@ void recompute_msgmni(struct ipc_namespa
 
 	if (allowed < MSGMNI) {
 		ns->msg_ctlmni = MSGMNI;
-		goto out_callback;
+		return;
 	}
 
 	if (allowed > IPCMNI / nb_ns) {
 		ns->msg_ctlmni = IPCMNI / nb_ns;
-		goto out_callback;
+		return;
 	}
 
 	ns->msg_ctlmni = allowed;
-
-out_callback:
-
-	printk(KERN_INFO "msgmni has been set to %d for ipc namespace %p\n",
-		ns->msg_ctlmni, ns);
 }
 
 void msg_init_ns(struct ipc_namespace *ns)
@@ -136,6 +131,10 @@ void msg_exit_ns(struct ipc_namespace *n
 void __init msg_init(void)
 {
 	msg_init_ns(&init_ipc_ns);
+
+	printk(KERN_INFO "msgmni has been set to %d\n",
+		init_ipc_ns.msg_ctlmni);
+
 	ipc_init_proc_interface("sysvipc/msg",
 				"       key      msqid perms      cbytes       qnum lspid lrpid   uid   gid  cuid  cgid      stime      rtime      ctime\n",
 				IPC_MSG_IDS, sysvipc_msg_proc_show);

--

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

* Re: [PATCH 1/1] Only output msgmni value at boot time
  2008-05-27 16:52   ` Luck, Tony
@ 2008-05-29  9:43     ` Nadia Derbey
  0 siblings, 0 replies; 3+ messages in thread
From: Nadia Derbey @ 2008-05-29  9:43 UTC (permalink / raw)
  To: Luck, Tony; +Cc: akpm, linux-kernel

Luck, Tony wrote:
>>In http://lkml.org/lkml/2008/4/29/575 Tony Luck complained that this message
>>references an ipc namespace address that is useless.
>>
>>I first thought of using an audit_log instead of a printk, as suggested by
>>Serge Hallyn. But unfortunately, we do not have any other information than
>>the namespace address to provide here too.
>>So I chose to move the message and output it only at boot time, removing the
>>reference to the namespace.
> 
> 
> Diffing my before/after dmesg(8) output:
> < msgmni has been set to 7964 for ipc namespace a000000100a1ad58
> ---
> 
>>msgmni has been set to 7964
> 
> 
> Much prettier.  Thank you.
> 
> I'll leave it to SGI to ponder whether it is correct to compute
> msgmni based on a linear function of lowmem (their big systems can
> have terabytes of memory, all of which is counted as lowmem).

Sure that if the formula can be enhanced, that would be great.
But don't forget 2 things:
. msgmni cannot become higher than IPCMNI: i.e. starting from 16Gb of 
lowmem, and based on a value of 16K for msgmnb, msgmni won't increase. 
(if I'm not wrong in my computation).
. there is no memory pre-allocation done based upon msgmni value: by 
increasing its value we are just making the DoS (for too many msg 
queues) come later.
. there is still the possibility of lowering the value "by hand" (via 
procfs) if ever it is found to be too high.

Regards,
Nadia

> 
> 
>>This patch applies to 2.6.26-rc2-mm1.
> 
> 
> Acked-by: Tony Luck <tony.luck@intel.com>
> 
> Signed-off-by: Nadia Derbey <Nadia.Derbey@bull.net>
> 
> ---
>  ipc/msg.c |   13 ++++++-------
>  1 file changed, 6 insertions(+), 7 deletions(-)
> 
> Index: linux-2.6.26-rc2-mm1/ipc/msg.c
> ===================================================================
> --- linux-2.6.26-rc2-mm1.orig/ipc/msg.c	2008-05-26 12:25:37.000000000 +0200
> +++ linux-2.6.26-rc2-mm1/ipc/msg.c	2008-05-27 10:59:34.000000000 +0200
> @@ -98,20 +98,15 @@ void recompute_msgmni(struct ipc_namespa
>  
>  	if (allowed < MSGMNI) {
>  		ns->msg_ctlmni = MSGMNI;
> -		goto out_callback;
> +		return;
>  	}
>  
>  	if (allowed > IPCMNI / nb_ns) {
>  		ns->msg_ctlmni = IPCMNI / nb_ns;
> -		goto out_callback;
> +		return;
>  	}
>  
>  	ns->msg_ctlmni = allowed;
> -
> -out_callback:
> -
> -	printk(KERN_INFO "msgmni has been set to %d for ipc namespace %p\n",
> -		ns->msg_ctlmni, ns);
>  }
>  
>  void msg_init_ns(struct ipc_namespace *ns)
> @@ -136,6 +131,10 @@ void msg_exit_ns(struct ipc_namespace *n
>  void __init msg_init(void)
>  {
>  	msg_init_ns(&init_ipc_ns);
> +
> +	printk(KERN_INFO "msgmni has been set to %d\n",
> +		init_ipc_ns.msg_ctlmni);
> +
>  	ipc_init_proc_interface("sysvipc/msg",
>  				"       key      msqid perms      cbytes       qnum lspid lrpid   uid   gid  cuid  cgid      stime      rtime      ctime\n",
>  				IPC_MSG_IDS, sysvipc_msg_proc_show);
> 





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

end of thread, other threads:[~2008-05-29  9:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20080527082441.239624000@bull.net>
2008-05-27  8:24 ` [PATCH 1/1] Only output msgmni value at boot time Nadia.Derbey
2008-05-27 16:52   ` Luck, Tony
2008-05-29  9:43     ` Nadia Derbey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox