Change default MSGMNI tunable to scale with lowmem (v3)
Subsystems (5)
cover Change default MSGMNI tunable to scale with lowmem (v3)
Resending the set of patches after Yasunori's remark about being able to turn on/off automatic recomputing.
(see message at http://lkml.org/lkml/2008/2/5/149).
I actually introduced an intermediate solution: when msgmni is set by hand, it is uneregistered from the ipcns notifier chain (i.e. automatic recomputing is disabled). This corresponds to an implicit turn off. Setting it to a negative value makes it registered back in the notifier chain (which corresponds to the turn on proposed by Yasunaori).
Only patch # 8 introduces new stuff compared to the already sent patch sets.
Also ported the patchset to 2.6.24-mm1.
-------------------
On large systems we'd like to allow a larger number of message queues. In some cases up to 32K. However simply setting MSGMNI to a larger value may cause problems for smaller systems.
The first patch of this series introduces a default maximum number of message queue ids that scales with the amount of lowmem.
Since msgmni is per namespace and there is no amount of memory dedicated to each namespace so far, the second patch of this series scales msgmni to the number of ipc namespaces too.
Since msgmni depends on the amount of memory, it becomes necessary to recompute it upon memory add/remove.
In the 4th patch, memory hotplug management is added: a notifier block is registered into the memory hotplug notifier chain for the ipc subsystem. Since the ipc namespaces are not linked together, they have their own notification chain: one notifier_block is defined per ipc namespace. Each time an ipc namespace is created (removed) it registers (unregisters) its notifier block in (from) the ipcns chain.
The callback routine registered in the memory chain invokes the ipcns notifier chain with the IPCNS_MEMCHANGE event.
Each callback routine registered in the ipcns namespace, in turn, recomputes msgmni for the owning namespace.
The 5th patch makes it possible to keep the memory hotplug notifier chain's lock for a lesser amount of time: instead of directly notifying the ipcns notifier chain upon memory add/remove, a work item is added to the global workqueue. When activated, this work item is the one who notifies the ipcns notifier chain.
Since msgmni depends on the number of ipc namespaces, it becomes necessary to recompute it upon ipc namespace creation / removal.
The 6th patch uses the ipc namespace notifier chain for that purpose: that chain is notified each time an ipc namespace is created or removed. This makes it possible to recompute msgmni for all the namespaces each time one of them is created or removed.
When msgmni is explicitely set from userspace, we should avoid recomputing it upon memory add/remove or ipcns creation/removal.
This is what the 7th patch does: it simply unregisters the ipcns callback routine as soon as msgmni has been changed from procfs or sysctl().
Even if msgmni is set by hand, it should be possible to make it back automatically recomputed upon memory add/remove or ipcns creation/removal. This what is achieved in patch 8: if set to a negative value, msgmni is added back to the ipcns notifier chain, making it automatically recomputed again.
These patches should be applied to 2.6.24-mm1, in the following order:
[PATCH 1/8]: ipc_scale_msgmni_with_lowmem.patch
[PATCH 2/8]: ipc_scale_msgmni_with_namespaces.patch [PATCH 3/8]: ipc_slab_memory_callback_prio_to_const.patch [PATCH 4/8]: ipc_recompute_msgmni_on_memory_hotplug.patch [PATCH 5/8]: ipc_ipcns_notification_workqueue.patch [PATCH 6/8]: ipc_recompute_msgmni_on_ipcns_create_remove.patch [PATCH 7/8]: ipc_unregister_callback_on_msgmni_manual_change.patch [PATCH 8/8]: ipc_register_callback_on_negative_msgmni.patch
Andrew, do you think this patchset could be considered for inclusion in -mm (or at least patches 1 to 6)?
Regards,
Nadia
--
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH 1/8 Scaling msgmni to the amount of lowmem
[PATCH 01/08]
This patch computes msg_ctlmni to make it scale with the amount of lowmem. msg_ctlmni is now set to make the message queues occupy 1/32 of the available lowmem.
Some cleaning has also been done for the MSGPOOL constant: the msgctl man page says it's not used, but it also defines it as a size in bytes (the code expresses it in Kbytes).
--- include/linux/msg.h | 14 ++++++++++++-- ipc/msg.c | 37 ++++++++++++++++++++++++++++++++++++- 2 files changed, 48 insertions(+), 3 deletions(-)
include/linux/msg.h +12 -2
@@ -49,16 +49,26 @@ struct msginfo {unsigned short msgseg; }; +/* +* Scaling factor to compute msgmni: +* the memory dedicated to msg queues (msgmni * msgmnb) should occupy +* at most 1/MSG_MEM_SCALE of the lowmem (see the formula in ipc/msg.c): +* up to 8MB : msgmni = 16 (MSGMNI) +* 4 GB : msgmni = 8K +* more than 16 GB : msgmni = 32K (IPCMNI) +*/ +#define MSG_MEM_SCALE 32 +#define MSGMNI 16/* <= IPCMNI */ /* max # of msg queue identifiers */ #define MSGMAX 8192/* <= INT_MAX */ /* max size of message (bytes) */ #define MSGMNB 16384/* <= INT_MAX */ /* default max size of a message queue */ /* unused */ -#define MSGPOOL (MSGMNI*MSGMNB/1024)/* size in kilobytes of message pool */ +#define MSGPOOL (MSGMNI * MSGMNB)/* size in bytes of message pool */ #define MSGTQL MSGMNB/* number of system message headers */ #define MSGMAP MSGMNB/* number of entries in message map */ #define MSGSSZ 16/* message segment size */ -#define __MSGSEG ((MSGPOOL*1024)/ MSGSSZ)/* max no. of segments */ +#define __MSGSEG (MSGPOOL / MSGSSZ)/* max no. of segments */ #define MSGSEG (__MSGSEG <= 0xffff ? __MSGSEG : 0xffff)#ifdef __KERNEL__
ipc/msg.c +36 -1
@@ -27,6 +27,7 @@#include <linux/msg.h> #include <linux/spinlock.h> #include <linux/init.h> +#include <linux/mm.h> #include <linux/proc_fs.h> #include <linux/list.h> #include <linux/security.h>
@@ -78,11 +79,45 @@ static int newque(struct ipc_namespace *static int sysvipc_msg_proc_show (struct seq_file *s,void *it);#endif +/* +* Scale msgmni with the available lowmem size: the memory dedicated to msg +* queues should occupy at most 1/MSG_MEM_SCALE of lowmem. +* This should be done staying within the (MSGMNI , IPCMNI) range. +*/ +static void recompute_msgmni (struct ipc_namespace *ns) +{ +struct sysinfo i; +unsigned long allowed; + +si_meminfo (&i); + allowed = (((i.totalram - i.totalhigh) /MSG_MEM_SCALE ) * i.mem_unit) + /MSGMNB ; + +if (allowed <MSGMNI ) { + ns->msg_ctlmni =MSGMNI ; + goto out_callback; + } + +if (allowed >IPCMNI ) { + ns->msg_ctlmni =IPCMNI ; + goto out_callback; + } + + 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) { ns->msg_ctlmax =MSGMAX ; ns->msg_ctlmnb =MSGMNB ; - ns->msg_ctlmni =MSGMNI ; + +recompute_msgmni (ns); +atomic_set (&ns->msg_bytes,0 );atomic_set (&ns->msg_hdrs,0 );ipc_init_ids (&ns->ids[IPC_MSG_IDS ]);
--
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Andrew Morton
maintainerRe: [PATCH 1/8] Scaling msgmni to the amount of lowmem
Quoted 10 lines · On Mon, 11 Feb 2008 15:16:47 +0100 Nadia.Derbey-6ktuUTfB/[email protected]…
[PATCH 01/08]
This patch computes
msg_ctlmnito make it scale with the amount of lowmem.msg_ctlmniis now set to make the message queues occupy 1/32 of the available lowmem.Some cleaning has also been done for the MSGPOOL constant: the msgctl man page says it's not used, but it also defines it as a size in bytes (the code expresses it in Kbytes).
Something's wrong here. Running LTP's msgctl08 (specifically:
ltp-full-20070228) cripples the machine. It's a 4-way 4GB x86_64.
http://userweb.kernel.org/~akpm/config-x.txt
http://userweb.kernel.org/~akpm/dmesg-x.txt
Normally msgctl08 will complete in a second or two. With this patch I don't know how long it will take to complete, and the machine is horridly bogged down. It does recover if you manage to kill msgctl08. Feels like a terrible memory shortage, but there's plenty of memory free and it isn't swapping.
Re: [PATCH 1/8] Scaling msgmni to the amount of lowmem
Quoted 18 lines · Andrew Morton
Quoted 10 lines · On Mon, 11 Feb 2008 15:16:47 +0100 [email protected] wrote:
[PATCH 01/08]
This patch computes
msg_ctlmnito make it scale with the amount of lowmem.msg_ctlmniis now set to make the message queues occupy 1/32 of the available lowmem.Some cleaning has also been done for the MSGPOOL constant: the msgctl man page says it's not used, but it also defines it as a size in bytes (the code expresses it in Kbytes).
Something's wrong here. Running LTP's msgctl08 (specifically:
ltp-full-20070228) cripples the machine. It's a 4-way 4GBx86_64.
Quoted 11 lines
http://userweb.kernel.org/~akpm/config-x.txt
http://userweb.kernel.org/~akpm/dmesg-x.txtNormally msgctl08 will complete in a second or two. With this patch I don't know how long it will take to complete, and the machine is horridly bogged down. It does recover if you manage to kill msgctl08. Feels like a terrible memory shortage, but there's plenty of memory free and it isn't swapping.
Before the patchset, msgctl08 used to be run with the old msgmni value: 16. Now it is run with a much higher msgmni value (1746 in my case), since it scales to the memory size. When I call "msgctl08 100000 16" it completes fast.
Doing the follwing on the ref kernel:
echo 1746 > /proc/sys/kernel/msgmni
msgctl08 100000 1746
makes th test block too :-(
Will check to see where the problem comes from.
Rgards,
Nadia
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH 1/8] Scaling msgmni to the amount of lowmem
Quoted 35 lines · Nadia Derbey
Quoted 18 lines · Andrew Morton
Quoted 10 lines · On Mon, 11 Feb 2008 15:16:47 +0100 [email protected] wrote:
[PATCH 01/08]
This patch computes
msg_ctlmnito make it scale with the amount of lowmem.msg_ctlmniis now set to make the message queues occupy 1/32 of the available lowmem.Some cleaning has also been done for the MSGPOOL constant: the msgctl man page says it's not used, but it also defines it as a size in bytes (the code expresses it in Kbytes).
Something's wrong here. Running LTP's msgctl08 (specifically:
ltp-full-20070228) cripples the machine. It's a 4-way 4GBx86_64.Quoted 11 lines
http://userweb.kernel.org/~akpm/config-x.txt
http://userweb.kernel.org/~akpm/dmesg-x.txtNormally msgctl08 will complete in a second or two. With this patch I don't know how long it will take to complete, and the machine is horridly bogged down. It does recover if you manage to kill msgctl08. Feels like a terrible memory shortage, but there's plenty of memory free and it isn't swapping.
Before the patchset, msgctl08 used to be run with the old msgmni value: 16. Now it is run with a much higher msgmni value (1746 in my case), since it scales to the memory size. When I call "msgctl08 100000 16" it completes fast.
Quoted 8 lines
Doing the follwing on the ref kernel:
echo 1746 >/proc/sys/kernel/msgmni
msgctl08 100000 1746makes th test block too :-(
Will check to see where the problem comes from.
Well, actually, the test does not block, it only takes much much more time to be executed:
doing this:
date; ./msgctl08 100000 XXX; date
gives us the following results:
XXX 16 32 64 128 256 512 1024 1746
time(secs) 2 4 8 16 32 64 132 241
XXX is the # of msg queues to be created = # of processes to be forked as readers = # of processes to be created as writers time is approximative since it is obtained by a "date" before and after.
XXX used to be 16 before the patchset ---> 1st column
--> 16 processes forked as reader
--> + 16 processes forked as writers
--> + 16 msg queues
XXX = 1746 (on my victim) after the patchset ---> last column
--> 1746 reader processes forked
--> + 1746 writers forked
--> + 1746 msg queues createdThe same tests on the ref kernel give approximatly the same results.
So if we don't want this longer time to appear as a regression, the LTP should be changed:
1) either by setting the result of get_max_msgqueues() as the MSGMNI constant (16) (that would be the best solution in my mind)
2) or by warning the tester that it may take a long time to finish.
There would be 3 tests impacted:
kernel/syscalls/ipc/msgctl/msgctl08.ckernel/syscalls/ipc/msgctl/msgctl09.ckernel/syscalls/ipc/msgget/msgget03.c
Cc-ing ltp mailing list ...
Regards,
Nadia
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [LTP] [PATCH 1/8] Scaling msgmni to the amount of lowmem
Quoted 83 lines
Quoted 41 lines · Nadia Derbey
Quoted 24 lines · Andrew Morton
Quoted 8 lines · On Mon, 11 Feb 2008 15:16:47 +0100 [email protected] wrote:
[PATCH 01/08]
This patch computes
msg_ctlmnito make it scale with the amount of lowmem.msg_ctlmniis now set to make the message queues occupy 1/32 of the available
lowmem.Quoted 5 lines
Some cleaning has also been done for the MSGPOOL constant: the msgctl man page
says it's not used, but it also defines it as a size in bytes (the code expresses it in Kbytes).Something's wrong here. Running LTP's msgctl08 (specifically:
ltp-full-20070228) cripples the machine. It's a 4-way 4GBx86_64.http://userweb.kernel.org/~akpm/config-x.txt
http://userweb.kernel.org/~akpm/dmesg-x.txtQuoted 9 lines
Normally msgctl08 will complete in a second or two. With this patch I don't know how long it will take to complete, and the machine is horridly bogged down. It does recover if you manage to kill msgctl08. Feels like a terrible memory shortage, but there's plenty of memory free and it isn't
swapping.Before the patchset, msgctl08 used to be run with the old msgmni value:
16. Now it is run with a much higher msgmni value (1746 in my case), since it scales to the memory size.
When I call "msgctl08 100000 16" it completes fast.Quoted 8 lines
Doing the follwing on the ref kernel:
echo 1746 >/proc/sys/kernel/msgmni
msgctl08 100000 1746makes th test block too :-(
Will check to see where the problem comes from.
Well, actually, the test does not block, it only takes much much more time to be executed:
doing this:
date; ./msgctl08 100000 XXX; dategives us the following results:
XXX 16 32 64 128 256 512 1024 1746
time(secs) 2 4 8 16 32 64 132 241XXX is the # of msg queues to be created = # of processes to be forked as readers = # of processes to be created as writers
time is approximative since it is obtained by a "date" before and after.XXX used to be 16 before the patchset ---> 1st column
--> 16 processes forked as reader --> + 16 processes forked as writers --> + 16 msg queues XXX = 1746 (on my victim) after the patchset ---> last column --> 1746 reader processes forked --> + 1746 writers forked --> + 1746 msg queues createdThe same tests on the ref kernel give approximatly the same results.
So if we don't want this longer time to appear as a regression, the LTP should be changed:
1) either by setting the result ofget_max_msgqueues()as the MSGMNI constant (16) (that would be the best solution in my mind)
2) or by warning the tester that it may take a long time to finish.
Quoted 5 lines
There would be 3 tests impacted:
kernel/syscalls/ipc/msgctl/msgctl08.ckernel/syscalls/ipc/msgctl/msgctl09.ckernel/syscalls/ipc/msgget/msgget03.c
We will change the test case if need that be. Nadia, kindly send us the patch set which will do the necessary changes.
Regards--
Subrata
Quoted 8 lines
Cc-ing ltp mailing list ...
Regards,
Nadia
Quoted 8 lines
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Ltp-list mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [LTP] [PATCH 1/8] Scaling msgmni to the amount of lowmem
Quoted 83 lines · Subrata Modak
Quoted 76 lines
Quoted 37 lines · Nadia Derbey
Quoted 19 lines · Andrew Morton
Quoted 10 lines · On Mon, 11 Feb 2008 15:16:47 +0100 [email protected] wrote:
[PATCH 01/08]
This patch computes
msg_ctlmnito make it scale with the amount of lowmem.msg_ctlmniis now set to make the message queues occupy 1/32 of the available lowmem.Some cleaning has also been done for the MSGPOOL constant: the msgctl man page says it's not used, but it also defines it as a size in bytes (the code expresses it in Kbytes).
Something's wrong here. Running LTP's msgctl08 (specifically:
ltp-full-20070228) cripples the machine. It's a 4-way 4GBx86_64.Quoted 11 lines
http://userweb.kernel.org/~akpm/config-x.txt
http://userweb.kernel.org/~akpm/dmesg-x.txtNormally msgctl08 will complete in a second or two. With this patch I don't know how long it will take to complete, and the machine is horridly bogged down. It does recover if you manage to kill msgctl08. Feels like a terrible memory shortage, but there's plenty of memory free and it isn't swapping.
Before the patchset, msgctl08 used to be run with the old msgmni value: 16. Now it is run with a much higher msgmni value (1746 in my case), since it scales to the memory size. When I call "msgctl08 100000 16" it completes fast.
Quoted 8 lines
Doing the follwing on the ref kernel:
echo 1746 >/proc/sys/kernel/msgmni
msgctl08 100000 1746makes th test block too :-(
Will check to see where the problem comes from.
Well, actually, the test does not block, it only takes much much more time to be executed:
doing this:
date; ./msgctl08 100000 XXX; dategives us the following results:
XXX 16 32 64 128 256 512 1024 1746
time(secs) 2 4 8 16 32 64 132 241XXX is the # of msg queues to be created = # of processes to be forked as readers = # of processes to be created as writers time is approximative since it is obtained by a "date" before and after.
XXX used to be 16 before the patchset ---> 1st column
--> 16 processes forked as reader --> + 16 processes forked as writers --> + 16 msg queues XXX = 1746 (on my victim) after the patchset ---> last column --> 1746 reader processes forked --> + 1746 writers forked --> + 1746 msg queues createdThe same tests on the ref kernel give approximatly the same results.
So if we don't want this longer time to appear as a regression, the LTP should be changed:
1) either by setting the result ofget_max_msgqueues()as the MSGMNI constant (16) (that would be the best solution in my mind)
2) or by warning the tester that it may take a long time to finish.Quoted 5 lines
There would be 3 tests impacted:
kernel/syscalls/ipc/msgctl/msgctl08.ckernel/syscalls/ipc/msgctl/msgctl09.ckernel/syscalls/ipc/msgget/msgget03.c
Quoted 6 lines
We will change the test case if need that be. Nadia, kindly send us the patch set which will do the necessary changes.
Regards--
Subrata
Subrata,
You'll find the patch in attachment.
FYI I didn't change msgget03.c since we need to get the actual max value in order to generate an error.
Regards,
Nadia
Since msgmni now scales to the memory size, it may reach big values. To avoid forking 2*msgmni processes and create msgmni msg queues, do not take msgmni from procfs anymore.
Just define it as 16 (which is the MSGMNI constant value in linux/msg.h)
Also fixed the Makefiles in ipc/lib and ipc/msgctl: there was no dependency on the lib/ipc*.h header files.
--- testcases/kernel/syscalls/ipc/lib/Makefile | 3 +++ testcases/kernel/syscalls/ipc/lib/ipcmsg.h | 2 ++ testcases/kernel/syscalls/ipc/msgctl/Makefile | 3 +++ testcases/kernel/syscalls/ipc/msgctl/msgctl08.c | 23 ++--------------------- testcases/kernel/syscalls/ipc/msgctl/msgctl09.c | 24 ++---------------------- 5 files changed, 12 insertions(+), 43 deletions(-)
testcases/kernel/syscalls/ipc/msgctl/msgctl08.c +2 -21
@@ -50,6 +50,7 @@#include <sys/msg.h> #include "test.h" #include "usctest.h" +#include "ipcmsg.h" void setup ();void cleanup ();
@@ -479,26 +480,6 @@ static int get_used_msgqueues()return used_queues; } -/** Get the max number of message queues allowed on system */ -static int get_max_msgqueues () -{ -FILE *f; -char buff[BUFSIZE ]; - -/* Get the max number of message queues allowed on system */ - f =fopen ("/proc/sys/kernel/msgmni" ,"r" ); -if (!f){ -tst_resm (TBROK ,"Could not open /proc/sys/kernel/msgmni" ); -tst_exit (); - } -if (!fgets (buff,BUFSIZE , f)) { -tst_resm (TBROK ,"Could not read /proc/sys/kernel/msgmni" ); -tst_exit (); - } -fclose (f); -return atoi (buff); -} -/*************************************************************** * setup() - performs all ONE TIME setup for this test. *****************************************************************/
@@ -520,7 +501,7 @@ setup()*/ TEST_PAUSE ; -MSGMNI =get_max_msgqueues () -get_used_msgqueues (); +MSGMNI =MAX_MSGQUEUES -get_used_msgqueues ();if (MSGMNI <=0 ){tst_resm (TBROK ,"Max number of message queues already used, cannot create more." );cleanup ();
testcases/kernel/syscalls/ipc/msgctl/msgctl09.c +2 -22
@@ -49,6 +49,7 @@#include <unistd.h> #include "test.h" #include "usctest.h" +#include "ipcmsg.h" #define MAXNREPS 1000#ifndef CONFIG_COLDFIRE
@@ -649,26 +650,6 @@ static int get_used_msgqueues()return used_queues; } -/** Get the max number of message queues allowed on system */ -static int get_max_msgqueues () -{ -FILE *f; -char buff[BUFSIZE ]; - -/* Get the max number of message queues allowed on system */ - f =fopen ("/proc/sys/kernel/msgmni" ,"r" ); -if (!f){ -tst_resm (TBROK ,"Could not open /proc/sys/kernel/msgmni" ); -tst_exit (); - } -if (!fgets (buff,BUFSIZE , f)) { -tst_resm (TBROK ,"Could not read /proc/sys/kernel/msgmni" ); -tst_exit (); - } -fclose (f); -return atoi (buff); -} -/*************************************************************** * setup() - performs all ONE TIME setup for this test. *****************************************************************/
@@ -689,12 +670,11 @@ setup()*/ TEST_PAUSE ; -MSGMNI =get_max_msgqueues () -get_used_msgqueues (); +MSGMNI =MAX_MSGQUEUES -get_used_msgqueues ();if (MSGMNI <=0 ){tst_resm (TBROK ,"Max number of message queues already used, cannot create more." );cleanup (); } - }
testcases/kernel/syscalls/ipc/lib/ipcmsg.h +2 -0
@@ -41,6 +41,8 @@ void setup(void);#define MSGSIZE 1024/* a resonable size for a message */ #define MSGTYPE 1/* a type ID for a message */ +#define MAX_MSGQUEUES 16/* MSGMNI as defined in linux/msg.h */ + typedef struct mbuf { /* a generic message structure */ long mtype; char mtext[MSGSIZE + 1]; /* add 1 here so the message can be 1024 */
testcases/kernel/syscalls/ipc/lib/Makefile +3 -0
@@ -19,6 +19,7 @@ SRCS = libipc.c OBJS = $(SRCS:.c=.o) LIBIPC = ../libipc.a +LIBIPC_HEADERS = ipcmsg.h ipcsem.h CFLAGS += -I../../../../../include -Wall
@@ -27,6 +28,8 @@ all: $(LIBIPC) $(LIBIPC): $(OBJS) $(AR) -rc $@ $(OBJS) +$(OBJS): $(LIBIPC_HEADERS) + install: clean:
testcases/kernel/syscalls/ipc/msgctl/Makefile +3 -0
@@ -18,12 +18,15 @@ CFLAGS += -I../lib -I../../../../../include -Wall LDLIBS += -L../../../../../lib -lltp -L.. -lipc +LIBIPC_HEADERS = ../lib/ipcmsg.h SRCS = $(wildcard *.c) TARGETS = $(patsubst %.c,%,$(SRCS)) all: $(TARGETS) +$(TARGETS): $(LIBIPC_HEADERS) + install: @set -e; for i in $(TARGETS); do ln -f $$i ../../../../bin/$$i ; done
Re: [LTP] [PATCH 1/8] Scaling msgmni to the amount of lowmem
On Tue, 2008-02-19 at 18:16 +0100, Nadia Derbey wrote:
<snip>
testcases/kernel/syscalls/ipc/lib/ipcmsg.h void setup(void); · line 45
Quoted 2 lines
testcases/kernel/syscalls/ipc/lib/ipcmsg.h +2
-0+#define MAX_MSGQUEUES 16/* MSGMNI as defined in linux/msg.h */ +
It's not quite the maximum anymore, is it? More like the minumum maximum ;). A better name might better document what the test is actually trying to do.
One question I have is whether the unpatched test is still valuable. Based on my limited knowledge of the test I suspect it's still a correct test of message queues. If so, perhaps renaming the old test (so it's not confused with a performance regression) and adding your patched version is best?
<snip>
Cheers,
-Matt Helsley
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [LTP] [PATCH 1/8] Scaling msgmni to the amount of lowmem
Quoted 12 lines · Matt Helsley
On Tue, 2008-02-19 at 18:16 +0100, Nadia Derbey wrote:
<snip>
testcases/kernel/syscalls/ipc/lib/ipcmsg.h void setup(void); · line 45
Quoted 2 lines
testcases/kernel/syscalls/ipc/lib/ipcmsg.h +2
-0+#define MAX_MSGQUEUES 16/* MSGMNI as defined in linux/msg.h */ +It's not quite the maximum anymore, is it? More like the minumum maximum ;). A better name might better document what the test is actually trying to do.
Quoted 6 lines
One question I have is whether the unpatched test is still valuable. Based on my limited knowledge of the test I suspect it's still a correct test of message queues. If so, perhaps renaming the old test (so it's not confused with a performance regression) and adding your patched version is best?
Yes, you're completely right.
I'll resend a patch today.
Regards,
Nadia
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
A message that is not in the archive (sent off-list or not yet received): 1203459418.7408.39.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/[email protected]
Re: [LTP] [PATCH 1/8] Scaling msgmni to the amount of lowmem
Quoted 12 lines · Matt Helsley
On Tue, 2008-02-19 at 18:16 +0100, Nadia Derbey wrote:
<snip>
testcases/kernel/syscalls/ipc/lib/ipcmsg.h void setup(void); · line 45
Quoted 2 lines
testcases/kernel/syscalls/ipc/lib/ipcmsg.h +2
-0+#define MAX_MSGQUEUES 16/* MSGMNI as defined in linux/msg.h */ +It's not quite the maximum anymore, is it? More like the minumum maximum ;). A better name might better document what the test is actually trying to do.
Quoted 6 lines
One question I have is whether the unpatched test is still valuable. Based on my limited knowledge of the test I suspect it's still a correct test of message queues. If so, perhaps renaming the old test (so it's not confused with a performance regression) and adding your patched version is best?
Yes, you're completely right.
I'll resend a patch today.
Regards,
Nadia
Re: [LTP] [PATCH 1/8] Scaling msgmni to the amount of lowmem
In reply to a message not in the archiveQuoted 12 lines · Matt Helsley
On Tue, 2008-02-19 at 18:16 +0100, Nadia Derbey wrote:
<snip>
testcases/kernel/syscalls/ipc/lib/ipcmsg.h void setup(void); · line 45
Quoted 2 lines
testcases/kernel/syscalls/ipc/lib/ipcmsg.h +2
-0+#define MAX_MSGQUEUES 16/* MSGMNI as defined in linux/msg.h */ +It's not quite the maximum anymore, is it? More like the minumum maximum ;). A better name might better document what the test is actually trying to do.
Quoted 6 lines
One question I have is whether the unpatched test is still valuable. Based on my limited knowledge of the test I suspect it's still a correct test of message queues. If so, perhaps renaming the old test (so it's not confused with a performance regression) and adding your patched version is best?
So, here's the new patch based on Matt's points.
Subrata, it has to be applied on top of the original ltp-full-20080131. Please tell me if you'd prefer one based on the merged version you've got (i.e. with my Tuesday patch applied).
Regards,
Nadia
Re: [LTP] [PATCH 1/8] Scaling msgmni to the amount of lowmem
In reply to Matt HelsleyQuoted 12 lines · Matt Helsley
On Tue, 2008-02-19 at 18:16 +0100, Nadia Derbey wrote:
<snip>
testcases/kernel/syscalls/ipc/lib/ipcmsg.h void setup(void); · line 45
Quoted 2 lines
testcases/kernel/syscalls/ipc/lib/ipcmsg.h +2
-0+#define MAX_MSGQUEUES 16/* MSGMNI as defined in linux/msg.h */ +It's not quite the maximum anymore, is it? More like the minumum maximum ;). A better name might better document what the test is actually trying to do.
Quoted 6 lines
One question I have is whether the unpatched test is still valuable. Based on my limited knowledge of the test I suspect it's still a correct test of message queues. If so, perhaps renaming the old test (so it's not confused with a performance regression) and adding your patched version is best?
So, here's the new patch based on Matt's points.
Subrata, it has to be applied on top of the original ltp-full-20080131. Please tell me if you'd prefer one based on the merged version you've got (i.e. with my Tuesday patch applied).
Regards,
Nadia
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [LTP] [PATCH 1/8] Scaling msgmni to the amount of lowmem
Quoted 22 lines · Nadia Derbey
Quoted 13 lines · Matt Helsley
On Tue, 2008-02-19 at 18:16 +0100, Nadia Derbey wrote:
<snip>
Review
Quoted 2 lines
(quoted diff) +2
-0+#define MAX_MSGQUEUES 16 /* MSGMNI as defined in linux/msg.h */ +It's not quite the maximum anymore, is it? More like the minumum maximum ;). A better name might better document what the test is actually trying to do.
Quoted 6 lines
One question I have is whether the unpatched test is still valuable. Based on my limited knowledge of the test I suspect it's still a correct test of message queues. If so, perhaps renaming the old test (so it's not confused with a performance regression) and adding your patched version is best?
Quoted 4 lines
So, here's the new patch based on Matt's points.
Subrata, it has to be applied on top of the original ltp-full-20080131. Please tell me if you'd prefer one based on the merged version you've got (i.e. with my Tuesday patch applied).
Forgot the patch, sorry for that (thx Andrew).
Regards,
Nadia
Since msgmni now scales to the memory size, it may reach big values. To avoid forking 2*msgmni processes and create msgmni msg queues, take the min between the procfs value and MSGMNI (as found in linux/msg.h).
Also fixed the Makefiles in ipc/lib and ipc/msgctl: there was no dependency on the lib/ipc*.h header files.
Also integrated the following in libipc.a:
. get_max_msgqueues()
. get_used_msgqueues()
--- testcases/kernel/syscalls/ipc/lib/Makefile | 3 testcases/kernel/syscalls/ipc/lib/ipcmsg.h | 7 testcases/kernel/syscalls/ipc/lib/libipc.c | 54 + testcases/kernel/syscalls/ipc/msgctl/Makefile | 3 testcases/kernel/syscalls/ipc/msgctl/msgctl08.c | 63 -- testcases/kernel/syscalls/ipc/msgctl/msgctl09.c | 62 -- testcases/kernel/syscalls/ipc/msgctl/msgctl10.c | 527 ++++++++++++++++++ testcases/kernel/syscalls/ipc/msgctl/msgctl11.c | 696 ++++++++++++++++++++++++ testcases/kernel/syscalls/ipc/msgget/Makefile | 3 testcases/kernel/syscalls/ipc/msgget/msgget03.c | 22 10 files changed, 1326 insertions(+), 114 deletions(-)
testcases/kernel/syscalls/ipc/lib/ipcmsg.h +7 -0
@@ -41,6 +41,10 @@ void setup(void);#define MSGSIZE 1024/* a resonable size for a message */ #define MSGTYPE 1/* a type ID for a message */ +#define NR_MSGQUEUES 16/* MSGMNI as defined in linux/msg.h */ + +#define min (a, b) (((a) < (b)) ? (a) : (b)) + typedef struct mbuf { /* a generic message structure */ long mtype; char mtext[MSGSIZE + 1]; /* add 1 here so the message can be 1024 */
@@ -59,4 +63,7 @@ void rm_queue(int);int getipckey ();int getuserid (char *); +int get_max_msgqueues (void ); +int get_used_msgqueues (void ); +#endif /* ipcmsg.h */
testcases/kernel/syscalls/ipc/lib/libipc.c +54 -0
57 lines not on this page · raw message
testcases/kernel/syscalls/ipc/msgctl/msgctl08.c +16 -47
90 lines not on this page · raw message
testcases/kernel/syscalls/ipc/msgctl/msgctl09.c +15 -47
90 lines not on this page · raw message
testcases/kernel/syscalls/ipc/msgget/msgget03.c +2 -20
@@ -68,8 +68,6 @@ int exp_enos[] = {ENOSPC, 0}; /* 0 termiint *msg_q_arr =NULL ;/* hold the id's that we create */ int num_queue =0 ;/* count the queues created */ -static int get_max_msgqueues (); -int main (int ac,char **av) {int lc;/* loop counter */
@@ -121,24 +119,6 @@ int main(int ac, char **av)return (0 ); } -/** Get the max number of message queues allowed on system */ -int get_max_msgqueues () -{ -FILE *f; -char buff[512 ]; - -/* Get the max number of message queues allowed on system */ - f =fopen ("/proc/sys/kernel/msgmni" ,"r" ); -if (!f){ -tst_brkm (TBROK , cleanup,"Could not open /proc/sys/kernel/msgmni" ); - } -if (!fgets (buff,512 , f)) { -tst_brkm (TBROK , cleanup,"Could not read /proc/sys/kernel/msgmni" ); - } -fclose (f); -return atoi (buff); -} -/* * setup() - performs all the ONE TIME setup for this test. */
@@ -166,6 +146,8 @@ setup(void) msgkey =getipckey (); maxmsgs =get_max_msgqueues (); +if (maxmsgs <0 ) +tst_brkm (TBROK , cleanup,"" ); msg_q_arr = (int *)calloc (maxmsgs,sizeof (int ));if (msg_q_arr ==NULL ) {
testcases/kernel/syscalls/ipc/lib/Makefile +3 -0
@@ -19,6 +19,7 @@ SRCS = libipc.c OBJS = $(SRCS:.c=.o) LIBIPC = ../libipc.a +LIBIPC_HEADERS = ipcmsg.h ipcsem.h CFLAGS += -I../../../../../include -Wall
@@ -27,6 +28,8 @@ all: $(LIBIPC) $(LIBIPC): $(OBJS) $(AR) -rc $@ $(OBJS) +$(OBJS): $(LIBIPC_HEADERS) + install: clean:
testcases/kernel/syscalls/ipc/msgctl/Makefile +3 -0
@@ -18,12 +18,15 @@ CFLAGS += -I../lib -I../../../../../include -Wall LDLIBS += -L../../../../../lib -lltp -L.. -lipc +LIBIPC_HEADERS = ../lib/ipcmsg.h SRCS = $(wildcard *.c) TARGETS = $(patsubst %.c,%,$(SRCS)) all: $(TARGETS) +$(TARGETS): $(LIBIPC_HEADERS) + install: @set -e; for i in $(TARGETS); do ln -f $$i ../../../../bin/$$i ; done
testcases/kernel/syscalls/ipc/msgctl/msgctl10.c new file +527 -0
527 lines not on this page · raw message
testcases/kernel/syscalls/ipc/msgget/Makefile +3 -0
@@ -21,9 +21,12 @@ LDLIBS += -L../../../../../lib -lltp -L. SRCS = $(wildcard *.c) TARGETS = $(patsubst %.c,%,$(SRCS)) +LIBIPC_HEADERS = ../lib/ipcmsg.h all: $(TARGETS) +$(TARGETS): $(LIBIPC_HEADERS) + install: @set -e; for i in $(TARGETS); do ln -f $$i ../../../../bin/$$i ; done
testcases/kernel/syscalls/ipc/msgctl/msgctl11.c new file +696 -0
696 lines not on this page · raw message
Re: [LTP] [PATCH 1/8] Scaling msgmni to the amount of lowmem
Quoted 23 lines
Quoted 22 lines · Nadia Derbey
Quoted 19 lines · Matt Helsley
On Tue, 2008-02-19 at 18:16 +0100, Nadia Derbey wrote:
<snip>
Review
Quoted 2 lines
(quoted diff) +2
-0+#define MAX_MSGQUEUES 16 /* MSGMNI as defined in linux/msg.h */ +It's not quite the maximum anymore, is it? More like the minumum maximum ;). A better name might better document what the test is actually trying to do.
One question I have is whether the unpatched test is still valuable. Based on my limited knowledge of the test I suspect it's still a correct test of message queues. If so, perhaps renaming the old test (so it's not confused with a performance regression) and adding your patched version is best?
Quoted 5 lines
Quoted 5 lines
So, here's the new patch based on Matt's points.
Subrata, it has to be applied on top of the original ltp-full-20080131. Please tell me if you'd prefer one based on the merged version you've got (i.e. with my Tuesday patch applied).
Nadia, I would prefer Patch on the top of the already merged version (on top of latest CVS snapshot as of today). Anyways, thanks for all these effort :-)
--Subrata
Quoted 7 lines
Quoted 1 line
Forgot the patch, sorry for that (thx Andrew).
Regards,
Nadia
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [LTP] [PATCH 1/8] Scaling msgmni to the amount of lowmem
Quoted 27 lines · Subrata Modak
Quoted 27 lines
Quoted 25 lines · Nadia Derbey
Quoted 13 lines · Matt Helsley
On Tue, 2008-02-19 at 18:16 +0100, Nadia Derbey wrote:
<snip>
Review
Quoted 2 lines
(quoted diff) +2
-0+#define MAX_MSGQUEUES 16 /* MSGMNI as defined in linux/msg.h */ +It's not quite the maximum anymore, is it? More like the minumum maximum ;). A better name might better document what the test is actually trying to do.
Quoted 6 lines
One question I have is whether the unpatched test is still valuable. Based on my limited knowledge of the test I suspect it's still a correct test of message queues. If so, perhaps renaming the old test (so it's not confused with a performance regression) and adding your patched version is best?
So, here's the new patch based on Matt's points.
Quoted 9 lines
Quoted 1 line
Quoted 1 line
Subrata, it has to be applied on top of the original ltp-full-20080131. Please tell me if you'd prefer one based on the merged version you've got (i.e. with my Tuesday patch applied).
Nadia, I would prefer Patch on the top of the already merged version (on top of latest CVS snapshot as of today). Anyways, thanks for all these effort :-)
--Subrata
In attachment, you'll find a patch to apply on top of the patches I sent you on Tuesday.
Regards,
Nadia
Since msgmni now scales to the memory size, it may reach big values. To avoid forking 2*msgmni processes and create msgmni msg queues, take the min between the procfs value and MSGMNI (as found in linux/msg.h).
Also integrated the following in libipc.a:
. get_max_msgqueues()
. get_used_msgqueues()
--- testcases/kernel/syscalls/ipc/lib/ipcmsg.h | 7 testcases/kernel/syscalls/ipc/lib/libipc.c | 54 + testcases/kernel/syscalls/ipc/msgctl/msgctl08.c | 42 - testcases/kernel/syscalls/ipc/msgctl/msgctl09.c | 42 - testcases/kernel/syscalls/ipc/msgctl/msgctl10.c | 527 ++++++++++++++++++ testcases/kernel/syscalls/ipc/msgctl/msgctl11.c | 696 ++++++++++++++++++++++++ testcases/kernel/syscalls/ipc/msgget/Makefile | 3 testcases/kernel/syscalls/ipc/msgget/msgget03.c | 22 8 files changed, 1318 insertions(+), 75 deletions(-)
testcases/kernel/syscalls/ipc/lib/libipc.c +54 -0
@@ -201,3 +201,57 @@ rm_shm(int shm_id)tst_resm (TINFO ,"id = %d" , shm_id); } } + +#define BUFSIZE 512 + +/* +* Get the number of message queues already in use +*/ +int +get_used_msgqueues () +{ +FILE *f; +int used_queues; +char buff[BUFSIZE ]; + + f =popen ("ipcs -q" ,"r" ); +if (!f) { +tst_resm (TBROK ,"Could not run 'ipcs' to calculate used " +"message queues" ); +tst_exit (); + } +/* FIXME: Start at -4 because ipcs prints four lines of header */ +for (used_queues =-4 ;fgets (buff,BUFSIZE , f); used_queues++) + ; +pclose (f); +if (used_queues <0 ) { +tst_resm (TBROK ,"Could not read output of 'ipcs' to " +"calculate used message queues" ); +tst_exit (); + } +return used_queues; +} + +/* +* Get the max number of message queues allowed on system +*/ +int +get_max_msgqueues () +{ +FILE *f; +char buff[BUFSIZE ]; + +/* Get the max number of message queues allowed on system */ + f =fopen ("/proc/sys/kernel/msgmni" ,"r" ); +if (!f) { +tst_resm (TBROK ,"Could not open /proc/sys/kernel/msgmni" ); +return -1 ; + } +if (!fgets (buff,BUFSIZE , f)) { +fclose (f); +tst_resm (TBROK ,"Could not read /proc/sys/kernel/msgmni" ); +return -1 ; + } +fclose (f); +return atoi (buff); +}
testcases/kernel/syscalls/ipc/lib/ipcmsg.h +6 -1
@@ -41,7 +41,9 @@ void setup(void);#define MSGSIZE 1024/* a resonable size for a message */ #define MSGTYPE 1/* a type ID for a message */ -#define MAX_MSGQUEUES 16/* MSGMNI as defined in linux/msg.h */ +#define NR_MSGQUEUES 16/* MSGMNI as defined in linux/msg.h */ + +#define min (a, b) (((a) < (b)) ? (a) : (b)) typedef struct mbuf { /* a generic message structure */ long mtype;
@@ -61,4 +63,7 @@ void rm_queue(int);int getipckey ();int getuserid (char *); +int get_max_msgqueues (void ); +int get_used_msgqueues (void ); +#endif /* ipcmsg.h */
testcases/kernel/syscalls/ipc/msgctl/msgctl10.c new file +527 -0
527 lines not on this page · raw message
testcases/kernel/syscalls/ipc/msgctl/msgctl11.c new file +696 -0
696 lines not on this page · raw message
testcases/kernel/syscalls/ipc/msgctl/msgctl08.c +15 -27
63 lines not on this page · raw message
testcases/kernel/syscalls/ipc/msgctl/msgctl09.c +15 -27
63 lines not on this page · raw message
testcases/kernel/syscalls/ipc/msgget/msgget03.c +2 -20
@@ -68,8 +68,6 @@ int exp_enos[] = {ENOSPC, 0}; /* 0 termiint *msg_q_arr =NULL ;/* hold the id's that we create */ int num_queue =0 ;/* count the queues created */ -static int get_max_msgqueues (); -int main (int ac,char **av) {int lc;/* loop counter */
@@ -121,24 +119,6 @@ int main(int ac, char **av)return (0 ); } -/** Get the max number of message queues allowed on system */ -int get_max_msgqueues () -{ -FILE *f; -char buff[512 ]; - -/* Get the max number of message queues allowed on system */ - f =fopen ("/proc/sys/kernel/msgmni" ,"r" ); -if (!f){ -tst_brkm (TBROK , cleanup,"Could not open /proc/sys/kernel/msgmni" ); - } -if (!fgets (buff,512 , f)) { -tst_brkm (TBROK , cleanup,"Could not read /proc/sys/kernel/msgmni" ); - } -fclose (f); -return atoi (buff); -} -/* * setup() - performs all the ONE TIME setup for this test. */
@@ -166,6 +146,8 @@ setup(void) msgkey =getipckey (); maxmsgs =get_max_msgqueues (); +if (maxmsgs <0 ) +tst_brkm (TBROK , cleanup,"" ); msg_q_arr = (int *)calloc (maxmsgs,sizeof (int ));if (msg_q_arr ==NULL ) {
testcases/kernel/syscalls/ipc/msgget/Makefile +3 -0
@@ -21,9 +21,12 @@ LDLIBS += -L../../../../../lib -lltp -L. SRCS = $(wildcard *.c) TARGETS = $(patsubst %.c,%,$(SRCS)) +LIBIPC_HEADERS = ../lib/ipcmsg.h all: $(TARGETS) +$(TARGETS): $(LIBIPC_HEADERS) + install: @set -e; for i in $(TARGETS); do ln -f $$i ../../../../bin/$$i ; done
A message that is not in the archive (sent off-list or not yet received): 47BE6AD0.6070309-6ktuUTfB/[email protected]
Re: [LTP] [PATCH 1/8] Scaling msgmni to the amount of lowmem
Quoted 37 lines · Nadia Derbey
Quoted 36 lines · Subrata Modak
Quoted 25 lines
Quoted 23 lines · Nadia Derbey
Quoted 19 lines · Matt Helsley
On Tue, 2008-02-19 at 18:16 +0100, Nadia Derbey wrote:
<snip>
Review
Quoted 2 lines
(quoted diff) +2
-0+#define MAX_MSGQUEUES 16 /* MSGMNI as defined in linux/msg.h */ +It's not quite the maximum anymore, is it? More like the minumum maximum ;). A better name might better document what the test is actually trying to do.
One question I have is whether the unpatched test is still valuable. Based on my limited knowledge of the test I suspect it's still a correct test of message queues. If so, perhaps renaming the old test (so it's not confused with a performance regression) and adding your patched version is best?
Quoted 5 lines
Quoted 5 lines
So, here's the new patch based on Matt's points.
Subrata, it has to be applied on top of the original ltp-full-20080131. Please tell me if you'd prefer one based on the merged version you've got (i.e. with my Tuesday patch applied).
Nadia, I would prefer Patch on the top of the already merged version (on top of latest CVS snapshot as of today). Anyways, thanks for all these effort :-)
Quoted 5 lines
Quoted 2 lines
--Subrata
In attachment, you'll find a patch to apply on top of the patches I sent you on Tuesday.
Nadia,
Thanks a ton for that. The same has been merged.
Regards--
Subrata
Quoted 3 lines
Regards,
Nadia
Re: [LTP] [PATCH 1/8] Scaling msgmni to the amount of lowmem
In reply to Nadia DerbeyQuoted 37 lines · Nadia Derbey
Quoted 36 lines · Subrata Modak
Quoted 25 lines
Quoted 23 lines · Nadia Derbey
Quoted 19 lines · Matt Helsley
On Tue, 2008-02-19 at 18:16 +0100, Nadia Derbey wrote:
<snip>
Review
Quoted 2 lines
(quoted diff) +2
-0+#define MAX_MSGQUEUES 16 /* MSGMNI as defined in linux/msg.h */ +It's not quite the maximum anymore, is it? More like the minumum maximum ;). A better name might better document what the test is actually trying to do.
One question I have is whether the unpatched test is still valuable. Based on my limited knowledge of the test I suspect it's still a correct test of message queues. If so, perhaps renaming the old test (so it's not confused with a performance regression) and adding your patched version is best?
Quoted 5 lines
Quoted 5 lines
So, here's the new patch based on Matt's points.
Subrata, it has to be applied on top of the original ltp-full-20080131. Please tell me if you'd prefer one based on the merged version you've got (i.e. with my Tuesday patch applied).
Nadia, I would prefer Patch on the top of the already merged version (on top of latest CVS snapshot as of today). Anyways, thanks for all these effort :-)
Quoted 5 lines
Quoted 2 lines
--Subrata
In attachment, you'll find a patch to apply on top of the patches I sent you on Tuesday.
Nadia,
Thanks a ton for that. The same has been merged.
Regards--
Subrata
Quoted 3 lines
Regards,
Nadia
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
A message that is not in the archive (sent off-list or not yet received): 1203601178.4604.18.camel-NRFfyExJdYpgXGGE5LP+UZlqa2bBAFbm0E9HWUfgJXw@public.gmane.org
Re: [LTP] [PATCH 1/8] Scaling msgmni to the amount of lowmem
Quoted 27 lines · Subrata Modak
Quoted 27 lines
Quoted 25 lines · Nadia Derbey
Quoted 13 lines · Matt Helsley
On Tue, 2008-02-19 at 18:16 +0100, Nadia Derbey wrote:
<snip>
Review
Quoted 2 lines
(quoted diff) +2
-0+#define MAX_MSGQUEUES 16 /* MSGMNI as defined in linux/msg.h */ +It's not quite the maximum anymore, is it? More like the minumum maximum ;). A better name might better document what the test is actually trying to do.
Quoted 6 lines
One question I have is whether the unpatched test is still valuable. Based on my limited knowledge of the test I suspect it's still a correct test of message queues. If so, perhaps renaming the old test (so it's not confused with a performance regression) and adding your patched version is best?
So, here's the new patch based on Matt's points.
Quoted 9 lines
Quoted 1 line
Quoted 1 line
Subrata, it has to be applied on top of the original ltp-full-20080131. Please tell me if you'd prefer one based on the merged version you've got (i.e. with my Tuesday patch applied).
Nadia, I would prefer Patch on the top of the already merged version (on top of latest CVS snapshot as of today). Anyways, thanks for all these effort :-)
--Subrata
In attachment, you'll find a patch to apply on top of the patches I sent you on Tuesday.
Regards,
Nadia
_______________________________________________
Containers mailing list Containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
https://lists.linux-foundation.org/mailman/listinfo/containers
A message that is not in the archive (sent off-list or not yet received): 47BD7648.5010309-6ktuUTfB/[email protected]
Re: [LTP] [PATCH 1/8] Scaling msgmni to the amount of lowmem
Quoted 23 lines
Quoted 22 lines · Nadia Derbey
Quoted 19 lines · Matt Helsley
On Tue, 2008-02-19 at 18:16 +0100, Nadia Derbey wrote:
<snip>
Review
Quoted 2 lines
(quoted diff) +2
-0+#define MAX_MSGQUEUES 16 /* MSGMNI as defined in linux/msg.h */ +It's not quite the maximum anymore, is it? More like the minumum maximum ;). A better name might better document what the test is actually trying to do.
One question I have is whether the unpatched test is still valuable. Based on my limited knowledge of the test I suspect it's still a correct test of message queues. If so, perhaps renaming the old test (so it's not confused with a performance regression) and adding your patched version is best?
Quoted 5 lines
Quoted 5 lines
So, here's the new patch based on Matt's points.
Subrata, it has to be applied on top of the original ltp-full-20080131. Please tell me if you'd prefer one based on the merged version you've got (i.e. with my Tuesday patch applied).
Nadia, I would prefer Patch on the top of the already merged version (on top of latest CVS snapshot as of today). Anyways, thanks for all these effort :-)
--Subrata
Quoted 7 lines
Quoted 1 line
Forgot the patch, sorry for that (thx Andrew).
Regards,
Nadia
A message that is not in the archive (sent off-list or not yet received): 47BD705A.9020309-6ktuUTfB/[email protected]
Re: [LTP] [PATCH 1/8] Scaling msgmni to the amount of lowmem
Quoted 22 lines · Nadia Derbey
Quoted 13 lines · Matt Helsley
On Tue, 2008-02-19 at 18:16 +0100, Nadia Derbey wrote:
<snip>
testcases/kernel/syscalls/ipc/lib/ipcmsg.h void setup(void); · line 45
Quoted 2 lines
testcases/kernel/syscalls/ipc/lib/ipcmsg.h +2
-0+#define MAX_MSGQUEUES 16/* MSGMNI as defined in linux/msg.h */ +It's not quite the maximum anymore, is it? More like the minumum maximum ;). A better name might better document what the test is actually trying to do.
Quoted 6 lines
One question I have is whether the unpatched test is still valuable. Based on my limited knowledge of the test I suspect it's still a correct test of message queues. If so, perhaps renaming the old test (so it's not confused with a performance regression) and adding your patched version is best?
Quoted 4 lines
So, here's the new patch based on Matt's points.
Subrata, it has to be applied on top of the original ltp-full-20080131. Please tell me if you'd prefer one based on the merged version you've got (i.e. with my Tuesday patch applied).
Forgot the patch, sorry for that (thx Andrew).
Regards,
Nadia
_______________________________________________
Containers mailing list Containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
https://lists.linux-foundation.org/mailman/listinfo/containers
A message that is not in the archive (sent off-list or not yet received): 47BB0EDC.5000002-6ktuUTfB/[email protected]
Re: [LTP] [PATCH 1/8] Scaling msgmni to the amount of lowmem
On Tue, 2008-02-19 at 18:16 +0100, Nadia Derbey wrote:
<snip>
testcases/kernel/syscalls/ipc/lib/ipcmsg.h void setup(void); · line 45
Quoted 2 lines
testcases/kernel/syscalls/ipc/lib/ipcmsg.h +2
-0+#define MAX_MSGQUEUES 16/* MSGMNI as defined in linux/msg.h */ +
It's not quite the maximum anymore, is it? More like the minumum maximum ;). A better name might better document what the test is actually trying to do.
One question I have is whether the unpatched test is still valuable. Based on my limited knowledge of the test I suspect it's still a correct test of message queues. If so, perhaps renaming the old test (so it's not confused with a performance regression) and adding your patched version is best?
<snip>
Cheers,
-Matt Helsley
Re: [LTP] [PATCH 1/8] Scaling msgmni to the amount of lowmem
In reply to a message not in the archiveQuoted 101 lines
Quoted 93 lines · Subrata Modak
Quoted 86 lines
Quoted 43 lines · Nadia Derbey
Quoted 25 lines · Andrew Morton
Quoted 8 lines · On Mon, 11 Feb 2008 15:16:47 +0100 Nadia.Derbey-6ktuUTfB/[email protected]…
[PATCH 01/08]
This patch computes
msg_ctlmnito make it scale with the amount of lowmem.msg_ctlmniis now set to make the message queues occupy 1/32 of the available
lowmem.Quoted 5 lines
Some cleaning has also been done for the MSGPOOL constant: the msgctl man page
says it's not used, but it also defines it as a size in bytes (the code expresses it in Kbytes).Something's wrong here. Running LTP's msgctl08 (specifically:
ltp-full-20070228) cripples the machine. It's a 4-way 4GBx86_64.http://userweb.kernel.org/~akpm/config-x.txt
http://userweb.kernel.org/~akpm/dmesg-x.txtQuoted 9 lines
Normally msgctl08 will complete in a second or two. With this patch I don't know how long it will take to complete, and the machine is horridly bogged down. It does recover if you manage to kill msgctl08. Feels like a terrible memory shortage, but there's plenty of memory free and it isn't
swapping.Before the patchset, msgctl08 used to be run with the old msgmni value:
16. Now it is run with a much higher msgmni value (1746 in my case), since it scales to the memory size.
When I call "msgctl08 100000 16" it completes fast.Quoted 8 lines
Doing the follwing on the ref kernel:
echo 1746 >/proc/sys/kernel/msgmni
msgctl08 100000 1746makes th test block too :-(
Will check to see where the problem comes from.
Well, actually, the test does not block, it only takes much much more time to be executed:
doing this:
date; ./msgctl08 100000 XXX; dategives us the following results:
XXX 16 32 64 128 256 512 1024 1746
time(secs) 2 4 8 16 32 64 132 241XXX is the # of msg queues to be created = # of processes to be forked as readers = # of processes to be created as writers
time is approximative since it is obtained by a "date" before and after.XXX used to be 16 before the patchset ---> 1st column
--> 16 processes forked as reader --> + 16 processes forked as writers --> + 16 msg queues XXX = 1746 (on my victim) after the patchset ---> last column --> 1746 reader processes forked --> + 1746 writers forked --> + 1746 msg queues createdThe same tests on the ref kernel give approximatly the same results.
So if we don't want this longer time to appear as a regression, the LTP should be changed:
1) either by setting the result ofget_max_msgqueues()as the MSGMNI constant (16) (that would be the best solution in my mind)
2) or by warning the tester that it may take a long time to finish.Quoted 5 lines
There would be 3 tests impacted:
kernel/syscalls/ipc/msgctl/msgctl08.ckernel/syscalls/ipc/msgctl/msgctl09.ckernel/syscalls/ipc/msgget/msgget03.cQuoted 6 lines
We will change the test case if need that be. Nadia, kindly send us the patch set which will do the necessary changes.
Regards--
Subrata
Quoted 5 lines
Subrata,
You'll find the patch in attachment.
FYI I didn't changemsgget03.csince we need to get the actual max value in order to generate an error.
Thanks. The same has been Merged.
Regards--
Subrata
Quoted 4 lines
Regards,
Nadia
Re: [LTP] [PATCH 1/8] Scaling msgmni to the amount of lowmem
In reply to Nadia DerbeyQuoted 101 lines
Quoted 93 lines · Subrata Modak
Quoted 86 lines
Quoted 43 lines · Nadia Derbey
Quoted 25 lines · Andrew Morton
Quoted 8 lines · On Mon, 11 Feb 2008 15:16:47 +0100 [email protected] wrote:
[PATCH 01/08]
This patch computes
msg_ctlmnito make it scale with the amount of lowmem.msg_ctlmniis now set to make the message queues occupy 1/32 of the available
lowmem.Quoted 5 lines
Some cleaning has also been done for the MSGPOOL constant: the msgctl man page
says it's not used, but it also defines it as a size in bytes (the code expresses it in Kbytes).Something's wrong here. Running LTP's msgctl08 (specifically:
ltp-full-20070228) cripples the machine. It's a 4-way 4GBx86_64.http://userweb.kernel.org/~akpm/config-x.txt
http://userweb.kernel.org/~akpm/dmesg-x.txtQuoted 9 lines
Normally msgctl08 will complete in a second or two. With this patch I don't know how long it will take to complete, and the machine is horridly bogged down. It does recover if you manage to kill msgctl08. Feels like a terrible memory shortage, but there's plenty of memory free and it isn't
swapping.Before the patchset, msgctl08 used to be run with the old msgmni value:
16. Now it is run with a much higher msgmni value (1746 in my case), since it scales to the memory size.
When I call "msgctl08 100000 16" it completes fast.Quoted 8 lines
Doing the follwing on the ref kernel:
echo 1746 >/proc/sys/kernel/msgmni
msgctl08 100000 1746makes th test block too :-(
Will check to see where the problem comes from.
Well, actually, the test does not block, it only takes much much more time to be executed:
doing this:
date; ./msgctl08 100000 XXX; dategives us the following results:
XXX 16 32 64 128 256 512 1024 1746
time(secs) 2 4 8 16 32 64 132 241XXX is the # of msg queues to be created = # of processes to be forked as readers = # of processes to be created as writers
time is approximative since it is obtained by a "date" before and after.XXX used to be 16 before the patchset ---> 1st column
--> 16 processes forked as reader --> + 16 processes forked as writers --> + 16 msg queues XXX = 1746 (on my victim) after the patchset ---> last column --> 1746 reader processes forked --> + 1746 writers forked --> + 1746 msg queues createdThe same tests on the ref kernel give approximatly the same results.
So if we don't want this longer time to appear as a regression, the LTP should be changed:
1) either by setting the result ofget_max_msgqueues()as the MSGMNI constant (16) (that would be the best solution in my mind)
2) or by warning the tester that it may take a long time to finish.Quoted 5 lines
There would be 3 tests impacted:
kernel/syscalls/ipc/msgctl/msgctl08.ckernel/syscalls/ipc/msgctl/msgctl09.ckernel/syscalls/ipc/msgget/msgget03.cQuoted 6 lines
We will change the test case if need that be. Nadia, kindly send us the patch set which will do the necessary changes.
Regards--
Subrata
Quoted 5 lines
Subrata,
You'll find the patch in attachment.
FYI I didn't changemsgget03.csince we need to get the actual max value in order to generate an error.
Thanks. The same has been Merged.
Regards--
Subrata
Quoted 4 lines
Regards,
Nadia
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
A message that is not in the archive (sent off-list or not yet received): 1203411055.4612.5.camel-NRFfyExJdYpgXGGE5LP+UZlqa2bBAFbm0E9HWUfgJXw@public.gmane.org
Re: [LTP] [PATCH 1/8] Scaling msgmni to the amount of lowmem
Quoted 83 lines · Subrata Modak
Quoted 76 lines
Quoted 37 lines · Nadia Derbey
Quoted 19 lines · Andrew Morton
Quoted 10 lines · On Mon, 11 Feb 2008 15:16:47 +0100 Nadia.Derbey-6ktuUTfB/[email protected]…
[PATCH 01/08]
This patch computes
msg_ctlmnito make it scale with the amount of lowmem.msg_ctlmniis now set to make the message queues occupy 1/32 of the available lowmem.Some cleaning has also been done for the MSGPOOL constant: the msgctl man page says it's not used, but it also defines it as a size in bytes (the code expresses it in Kbytes).
Something's wrong here. Running LTP's msgctl08 (specifically:
ltp-full-20070228) cripples the machine. It's a 4-way 4GBx86_64.Quoted 11 lines
http://userweb.kernel.org/~akpm/config-x.txt
http://userweb.kernel.org/~akpm/dmesg-x.txtNormally msgctl08 will complete in a second or two. With this patch I don't know how long it will take to complete, and the machine is horridly bogged down. It does recover if you manage to kill msgctl08. Feels like a terrible memory shortage, but there's plenty of memory free and it isn't swapping.
Before the patchset, msgctl08 used to be run with the old msgmni value: 16. Now it is run with a much higher msgmni value (1746 in my case), since it scales to the memory size. When I call "msgctl08 100000 16" it completes fast.
Quoted 8 lines
Doing the follwing on the ref kernel:
echo 1746 >/proc/sys/kernel/msgmni
msgctl08 100000 1746makes th test block too :-(
Will check to see where the problem comes from.
Well, actually, the test does not block, it only takes much much more time to be executed:
doing this:
date; ./msgctl08 100000 XXX; dategives us the following results:
XXX 16 32 64 128 256 512 1024 1746
time(secs) 2 4 8 16 32 64 132 241XXX is the # of msg queues to be created = # of processes to be forked as readers = # of processes to be created as writers time is approximative since it is obtained by a "date" before and after.
XXX used to be 16 before the patchset ---> 1st column
--> 16 processes forked as reader --> + 16 processes forked as writers --> + 16 msg queues XXX = 1746 (on my victim) after the patchset ---> last column --> 1746 reader processes forked --> + 1746 writers forked --> + 1746 msg queues createdThe same tests on the ref kernel give approximatly the same results.
So if we don't want this longer time to appear as a regression, the LTP should be changed:
1) either by setting the result ofget_max_msgqueues()as the MSGMNI constant (16) (that would be the best solution in my mind)
2) or by warning the tester that it may take a long time to finish.Quoted 5 lines
There would be 3 tests impacted:
kernel/syscalls/ipc/msgctl/msgctl08.ckernel/syscalls/ipc/msgctl/msgctl09.ckernel/syscalls/ipc/msgget/msgget03.c
Quoted 6 lines
We will change the test case if need that be. Nadia, kindly send us the patch set which will do the necessary changes.
Regards--
Subrata
Subrata,
You'll find the patch in attachment.
FYI I didn't change msgget03.c since we need to get the actual max value in order to generate an error.
Regards,
Nadia
_______________________________________________
Containers mailing list Containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
https://lists.linux-foundation.org/mailman/listinfo/containers
A message that is not in the archive (sent off-list or not yet received): 47B9835A.3060507-6ktuUTfB/[email protected]
Re: [LTP] [PATCH 1/8] Scaling msgmni to the amount of lowmem
Quoted 83 lines
Quoted 41 lines · Nadia Derbey
Quoted 24 lines · Andrew Morton
Quoted 8 lines · On Mon, 11 Feb 2008 15:16:47 +0100 Nadia.Derbey-6ktuUTfB/[email protected]…
[PATCH 01/08]
This patch computes
msg_ctlmnito make it scale with the amount of lowmem.msg_ctlmniis now set to make the message queues occupy 1/32 of the available
lowmem.Quoted 5 lines
Some cleaning has also been done for the MSGPOOL constant: the msgctl man page
says it's not used, but it also defines it as a size in bytes (the code expresses it in Kbytes).Something's wrong here. Running LTP's msgctl08 (specifically:
ltp-full-20070228) cripples the machine. It's a 4-way 4GBx86_64.http://userweb.kernel.org/~akpm/config-x.txt
http://userweb.kernel.org/~akpm/dmesg-x.txtQuoted 9 lines
Normally msgctl08 will complete in a second or two. With this patch I don't know how long it will take to complete, and the machine is horridly bogged down. It does recover if you manage to kill msgctl08. Feels like a terrible memory shortage, but there's plenty of memory free and it isn't
swapping.Before the patchset, msgctl08 used to be run with the old msgmni value:
16. Now it is run with a much higher msgmni value (1746 in my case), since it scales to the memory size.
When I call "msgctl08 100000 16" it completes fast.Quoted 8 lines
Doing the follwing on the ref kernel:
echo 1746 >/proc/sys/kernel/msgmni
msgctl08 100000 1746makes th test block too :-(
Will check to see where the problem comes from.
Well, actually, the test does not block, it only takes much much more time to be executed:
doing this:
date; ./msgctl08 100000 XXX; dategives us the following results:
XXX 16 32 64 128 256 512 1024 1746
time(secs) 2 4 8 16 32 64 132 241XXX is the # of msg queues to be created = # of processes to be forked as readers = # of processes to be created as writers
time is approximative since it is obtained by a "date" before and after.XXX used to be 16 before the patchset ---> 1st column
--> 16 processes forked as reader --> + 16 processes forked as writers --> + 16 msg queues XXX = 1746 (on my victim) after the patchset ---> last column --> 1746 reader processes forked --> + 1746 writers forked --> + 1746 msg queues createdThe same tests on the ref kernel give approximatly the same results.
So if we don't want this longer time to appear as a regression, the LTP should be changed:
1) either by setting the result ofget_max_msgqueues()as the MSGMNI constant (16) (that would be the best solution in my mind)
2) or by warning the tester that it may take a long time to finish.
Quoted 5 lines
There would be 3 tests impacted:
kernel/syscalls/ipc/msgctl/msgctl08.ckernel/syscalls/ipc/msgctl/msgctl09.ckernel/syscalls/ipc/msgget/msgget03.c
We will change the test case if need that be. Nadia, kindly send us the patch set which will do the necessary changes.
Regards--
Subrata
Quoted 16 lines
Cc-ing ltp mailing list ...
Regards,
Nadia-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Ltp-list mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
A message that is not in the archive (sent off-list or not yet received): 47B94D8C.8040605-6ktuUTfB/[email protected]
Re: [PATCH 1/8] Scaling msgmni to the amount of lowmem
Quoted 41 lines · Nadia Derbey
Quoted 24 lines · Andrew Morton
Quoted 8 lines · On Mon, 11 Feb 2008 15:16:47 +0100 Nadia.Derbey-6ktuUTfB/[email protected]…
[PATCH 01/08]
This patch computes
msg_ctlmnito make it scale with the amount of lowmem.msg_ctlmniis now set to make the message queues occupy 1/32 of the available
lowmem.Quoted 5 lines
Some cleaning has also been done for the MSGPOOL constant: the msgctl man page
says it's not used, but it also defines it as a size in bytes (the code expresses it in Kbytes).Something's wrong here. Running LTP's msgctl08 (specifically:
ltp-full-20070228) cripples the machine. It's a 4-way 4GBx86_64.http://userweb.kernel.org/~akpm/config-x.txt
http://userweb.kernel.org/~akpm/dmesg-x.txtQuoted 9 lines
Normally msgctl08 will complete in a second or two. With this patch I don't know how long it will take to complete, and the machine is horridly bogged down. It does recover if you manage to kill msgctl08. Feels like a terrible memory shortage, but there's plenty of memory free and it isn't
swapping.Before the patchset, msgctl08 used to be run with the old msgmni value:
16. Now it is run with a much higher msgmni value (1746 in my case), since it scales to the memory size.
When I call "msgctl08 100000 16" it completes fast.
Quoted 8 lines
Doing the follwing on the ref kernel:
echo 1746 >/proc/sys/kernel/msgmni
msgctl08 100000 1746makes th test block too :-(
Will check to see where the problem comes from.
Well, actually, the test does not block, it only takes much much more time to be executed:
doing this:
date; ./msgctl08 100000 XXX; date
gives us the following results:
XXX 16 32 64 128 256 512 1024 1746
time(secs) 2 4 8 16 32 64 132 241
XXX is the # of msg queues to be created = # of processes to be forked as readers = # of processes to be created as writers
time is approximative since it is obtained by a "date" before and after.
XXX used to be 16 before the patchset ---> 1st column
--> 16 processes forked as reader
--> + 16 processes forked as writers
--> + 16 msg queues
XXX = 1746 (on my victim) after the patchset ---> last column
--> 1746 reader processes forked
--> + 1746 writers forked
--> + 1746 msg queues createdThe same tests on the ref kernel give approximatly the same results.
So if we don't want this longer time to appear as a regression, the LTP should be changed:
1) either by setting the result of get_max_msgqueues() as the MSGMNI constant (16) (that would be the best solution in my mind)
2) or by warning the tester that it may take a long time to finish.
There would be 3 tests impacted:
kernel/syscalls/ipc/msgctl/msgctl08.ckernel/syscalls/ipc/msgctl/msgctl09.ckernel/syscalls/ipc/msgget/msgget03.c
Cc-ing ltp mailing list ...
Regards,
Nadia
A message that is not in the archive (sent off-list or not yet received): 20080215215916.8566d337.akpm-de/[email protected]
Re: [PATCH 1/8] Scaling msgmni to the amount of lowmem
Quoted 18 lines · Andrew Morton
Quoted 10 lines · On Mon, 11 Feb 2008 15:16:47 +0100 Nadia.Derbey-6ktuUTfB/[email protected]…
[PATCH 01/08]
This patch computes
msg_ctlmnito make it scale with the amount of lowmem.msg_ctlmniis now set to make the message queues occupy 1/32 of the available lowmem.Some cleaning has also been done for the MSGPOOL constant: the msgctl man page says it's not used, but it also defines it as a size in bytes (the code expresses it in Kbytes).
Something's wrong here. Running LTP's msgctl08 (specifically:
ltp-full-20070228) cripples the machine. It's a 4-way 4GBx86_64.
Quoted 11 lines
http://userweb.kernel.org/~akpm/config-x.txt
http://userweb.kernel.org/~akpm/dmesg-x.txtNormally msgctl08 will complete in a second or two. With this patch I don't know how long it will take to complete, and the machine is horridly bogged down. It does recover if you manage to kill msgctl08. Feels like a terrible memory shortage, but there's plenty of memory free and it isn't swapping.
Before the patchset, msgctl08 used to be run with the old msgmni value:
16. Now it is run with a much higher msgmni value (1746 in my case), since it scales to the memory size.
When I call "msgctl08 100000 16" it completes fast.
Doing the follwing on the ref kernel:
echo 1746 > /proc/sys/kernel/msgmni
msgctl08 100000 1746
makes th test block too :-(
Will check to see where the problem comes from.
Rgards,
Nadia
Re: [PATCH 1/8] Scaling msgmni to the amount of lowmem
In reply to [email protected]Quoted 4 lines · On Mon, Feb 11, 2008 at 7:16 AM, <[email protected]> wrote:
Index:
linux-2.6.24-mm1/ipc/msg.c
===================================================================
---linux-2.6.24-mm1.orig/ipc/msg.c2008-02-07 15:02:29.000000000 +0100
+++linux-2.6.24-mm1/ipc/msg.c2008-02-07 15:24:19.000000000 +0100
...
Quoted 5 lines
+out_callback:
+
+ printk(KERN_INFO "msgmni has been set to %d for ipc namespace %p\n",
+ns->msg_ctlmni, ns);
+}
This patch has now made its way to mainline. I can see how this printk was really useful to you while developing this patch. But does it add much value in a production system? It just looks like another piece of clutter on the console to my uncontainerized eyes.
-Tony
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH 1/8] Scaling msgmni to the amount of lowmem
Quoted 21 lines · Tony Luck
Quoted 4 lines · On Mon, Feb 11, 2008 at 7:16 AM, <[email protected]> wrote:
Index:
linux-2.6.24-mm1/ipc/msg.c
===================================================================ipc/msg.c 2008-02-07 15:24:19.000000000 +0100 renamed from ipc/msg.c 2008-02-07 15:02:29.000000000 +0100 +0
-0...
ipc/msg.c 2008-02-07 15:24:19.000000000 +0100
Quoted 5 lines
ipc/msg.c 2008-02-07 15:24:19.000000000 +0100 renamed from ipc/msg.c 2008-02-07 15:02:29.000000000 +0100 +5
-0+out_callback: + + printk(KERN_INFO "msgmni has been set to %d for ipc namespace %p\n", + ns->msg_ctlmni, ns); +}This patch has now made its way to mainline. I can see how this printk was really useful to you while developing this patch. But does it add much value in a production system? It just looks like another piece of clutter on the console to my uncontainerized eyes.
Quoted 3 lines
-Tony
Well, this printk had been suggested by somebody (sorry I don't remember who) when I first submitted the patch. Actually I think it might be useful for a sysadmin to be aware of a change in the msgmni value: we have the message not only at boot time, but also each time msgmni is recomputed because of a change in the amount of memory. Also, at boot time, I think it's interesting to have the actual msgmni value: it used to unconditionally be set to 16. Some applications that used to need an initialization script setting msgmni to a higher value might not need that script anymore, since the new value might fit their needs.
Regards,
Nadia
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
RE: [PATCH 1/8] Scaling msgmni to the amount of lowmem
Quoted 5 lines
Well, this printk had been suggested by somebody (sorry I don't remember who) when I first submitted the patch. Actually I think it might be useful for a sysadmin to be aware of a change in the msgmni value: we have the message not only at boot time, but also each time msgmni is recomputed because of a change in the amount of memory.
If the message is directed at the system administrator, then it would be nice if there were some more meaningful way to show the namespace that is affected than just printing the hex address of the kernel structure.
As the sysadmin for my test systems, printing the hex address is mildly annoying ... I now have to add a new case to my scripts that look at dmesg output for unusual activity.
Is there some better "name for a namespace" than the address? Perhaps the process id of the process that instantiated the namespace???
-Tony
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
A message that is not in the archive (sent off-list or not yet received): 1FE6DD409037234FAB833C420AA843EC014392F9-7XlYjKTK0pM64kNsxIetb7fspsVTdybXVpNB7YpNyf8@public.gmane.org
Re: [PATCH 1/8] Scaling msgmni to the amount of lowmem
Quoted 10 lines · Luck, Tony
Quoted 5 lines
Well, this printk had been suggested by somebody (sorry I don't remember who) when I first submitted the patch. Actually I think it might be useful for a sysadmin to be aware of a change in the msgmni value: we have the message not only at boot time, but also each time msgmni is recomputed because of a change in the amount of memory.
If the message is directed at the system administrator, then it would be nice if there were some more meaningful way to show the namespace that is affected than just printing the hex address of the kernel structure.
Quoted 6 lines
As the sysadmin for my test systems, printing the hex address is mildly annoying ... I now have to add a new case to my scripts that look at dmesg output for unusual activity.
Is there some better "name for a namespace" than the address? Perhaps the process id of the process that instantiated the namespace???
I agree with Tony here. Aside from the nuisance it is to see that message on console every time I unshare a namespace, a printk doesn't seem like the right way to output the info. At most I'd say an audit message.
-serge
Re: [PATCH 1/8] Scaling msgmni to the amount of lowmem
In reply to a message not in the archiveQuoted 11 lines · Tony
Quoted 5 lines
Well, this printk had been suggested by somebody (sorry I don't remember who) when I first submitted the patch. Actually I think it might be useful for a sysadmin to be aware of a change in the msgmni value: we have the message not only at boot time, but also each time msgmni is recomputed because of a change in the amount of memory.
If the message is directed at the system administrator, then it would be nice if there were some more meaningful way to show the namespace that is affected than just printing the hex address of the kernel structure.
Quoted 7 lines
As the sysadmin for my test systems, printing the hex address is mildly annoying ... I now have to add a new case to my scripts that look at dmesg output for unusual activity.
Is there some better "name for a namespace" than the address? Perhaps the process id of the process that instantiated the namespace???
Unfortunately no when we are inside an ipc namespace, we don't have such interesting informations. But I agree with you, an address is not readable enough. I'll try to find a solution.
Regards,
Nadia
Re: [PATCH 1/8] Scaling msgmni to the amount of lowmem
In reply to Luck, TonyQuoted 10 lines · Luck, Tony
Quoted 5 lines
Well, this printk had been suggested by somebody (sorry I don't remember who) when I first submitted the patch. Actually I think it might be useful for a sysadmin to be aware of a change in the msgmni value: we have the message not only at boot time, but also each time msgmni is recomputed because of a change in the amount of memory.
If the message is directed at the system administrator, then it would be nice if there were some more meaningful way to show the namespace that is affected than just printing the hex address of the kernel structure.
Quoted 6 lines
As the sysadmin for my test systems, printing the hex address is mildly annoying ... I now have to add a new case to my scripts that look at dmesg output for unusual activity.
Is there some better "name for a namespace" than the address? Perhaps the process id of the process that instantiated the namespace???
I agree with Tony here. Aside from the nuisance it is to see that message on console every time I unshare a namespace, a printk doesn't seem like the right way to output the info. At most I'd say an audit message.
-serge
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH 1/8] Scaling msgmni to the amount of lowmem
Quoted 12 lines · Serge E. Hallyn
Quoted 10 lines · Luck, Tony
Quoted 1 line
Well, this printk had been suggested by somebody (sorry I don't remember who) when I first submitted the patch. Actually I think it might be useful for a sysadmin to be aware of a change in the msgmni value: we have the message not only at boot time, but also each time msgmni is recomputed because of a change in the amount of memory.
If the message is directed at the system administrator, then it would be nice if there were some more meaningful way to show the namespace that is affected than just printing the hex address of the kernel structure.
As the sysadmin for my test systems, printing the hex address is mildly annoying ... I now have to add a new case to my scripts that look at dmesg output for unusual activity.
Quoted 7 lines
Quoted 2 lines
Is there some better "name for a namespace" than the address? Perhaps the process id of the process that instantiated the namespace???
I agree with Tony here. Aside from the nuisance it is to see that message on console every time I unshare a namespace, a printk doesn't seem like the right way to output the info.
But you agree that this is happening only because you're doing tests related to namespaces, right? I don't think that in a "standard" configuration this will happen very frequently, but may be I'm wrong.
Quoted 3 lines
At most I'd say an audit
message.
That's a good idea. Thanks, Serge. I'll do that.
Regards,
Nadia
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
A message that is not in the archive (sent off-list or not yet received): 48214007.7050800-6ktuUTfB/[email protected]
Re: [PATCH 1/8] Scaling msgmni to the amount of lowmem
Quoted 17 lines · Nadia Derbey
Quoted 16 lines · Serge E. Hallyn
Quoted 15 lines · Luck, Tony
Quoted 5 lines
Well, this printk had been suggested by somebody (sorry I don't remember who) when I first submitted the patch. Actually I think it might be useful for a sysadmin to be aware of a change in the msgmni value: we have the message not only at boot time, but also each time msgmni is recomputed because of a change in the amount of memory.
If the message is directed at the system administrator, then it would be nice if there were some more meaningful way to show the namespace that is affected than just printing the hex address of the kernel structure.
As the sysadmin for my test systems, printing the hex address is mildly annoying ... I now have to add a new case to my scripts that look at dmesg output for unusual activity.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Is there some better "name for a namespace" than the address? Perhaps the process id of the process that instantiated the namespace???
I agree with Tony here. Aside from the nuisance it is to see that message on console every time I unshare a namespace, a printk doesn't seem like the right way to output the info.
But you agree that this is happening only because you're doing tests related to namespaces, right?
Yup :)
Quoted 7 lines
I don't think that in a "standard" configuration this will happen very frequently, but may be I'm wrong.
Quoted 2 lines
At most I'd say an audit
message.That's a good idea. Thanks, Serge. I'll do that.
It'll probably still end up a printk for me, but it'll be my own fault for not setting up audit.
Quoted 2 lines
Regards,
Nadia
thanks,
-serge
Re: [PATCH 1/8] Scaling msgmni to the amount of lowmem
In reply to Nadia DerbeyQuoted 17 lines · Nadia Derbey
Quoted 16 lines · Serge E. Hallyn
Quoted 15 lines · Luck, Tony
Quoted 5 lines
Well, this printk had been suggested by somebody (sorry I don't remember who) when I first submitted the patch. Actually I think it might be useful for a sysadmin to be aware of a change in the msgmni value: we have the message not only at boot time, but also each time msgmni is recomputed because of a change in the amount of memory.
If the message is directed at the system administrator, then it would be nice if there were some more meaningful way to show the namespace that is affected than just printing the hex address of the kernel structure.
As the sysadmin for my test systems, printing the hex address is mildly annoying ... I now have to add a new case to my scripts that look at dmesg output for unusual activity.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Is there some better "name for a namespace" than the address? Perhaps the process id of the process that instantiated the namespace???
I agree with Tony here. Aside from the nuisance it is to see that message on console every time I unshare a namespace, a printk doesn't seem like the right way to output the info.
But you agree that this is happening only because you're doing tests related to namespaces, right?
Yup :)
Quoted 7 lines
I don't think that in a "standard" configuration this will happen very frequently, but may be I'm wrong.
Quoted 2 lines
At most I'd say an audit
message.That's a good idea. Thanks, Serge. I'll do that.
It'll probably still end up a printk for me, but it'll be my own fault for not setting up audit.
Quoted 2 lines
Regards,
Nadia
thanks,
-serge
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
A message that is not in the archive (sent off-list or not yet received): 20080507131712.GA8580-6s5zFf/[email protected]
Re: [PATCH 1/8] Scaling msgmni to the amount of lowmem
Quoted 20 lines · Serge E. Hallyn
Quoted 19 lines · Nadia Derbey
Quoted 18 lines · Serge E. Hallyn
Quoted 17 lines · Luck, Tony
Quoted 5 lines
Well, this printk had been suggested by somebody (sorry I don't remember who) when I first submitted the patch. Actually I think it might be useful for a sysadmin to be aware of a change in the msgmni value: we have the message not only at boot time, but also each time msgmni is recomputed because of a change in the amount of memory.
If the message is directed at the system administrator, then it would be nice if there were some more meaningful way to show the namespace that is affected than just printing the hex address of the kernel structure.
As the sysadmin for my test systems, printing the hex address is mildly annoying ... I now have to add a new case to my scripts that look at dmesg output for unusual activity.
Is there some better "name for a namespace" than the address? Perhaps the process id of the process that instantiated the namespace???
Quoted 16 lines
Quoted 6 lines
Quoted 3 lines
I agree with Tony here. Aside from the nuisance it is to see that message on console every time I unshare a namespace, a printk doesn't seem like the right way to output the info.
But you agree that this is happening only because you're doing tests related to namespaces, right?
Yup :)
Quoted 7 lines
I don't think that in a "standard" configuration this will happen very frequently, but may be I'm wrong.
Quoted 2 lines
At most I'd say an audit
message.That's a good idea. Thanks, Serge. I'll do that.
I'm not familiar with kernel policies regarding audit messages. Are
audit messages treated anything like kernel interfaces when it comes to removing/changing them?
Cheers,
-Matt Helsley
Re: [PATCH 1/8] Scaling msgmni to the amount of lowmem
In reply to Serge E. HallynQuoted 20 lines · Serge E. Hallyn
Quoted 19 lines · Nadia Derbey
Quoted 18 lines · Serge E. Hallyn
Quoted 17 lines · Luck, Tony
Quoted 5 lines
Well, this printk had been suggested by somebody (sorry I don't remember who) when I first submitted the patch. Actually I think it might be useful for a sysadmin to be aware of a change in the msgmni value: we have the message not only at boot time, but also each time msgmni is recomputed because of a change in the amount of memory.
If the message is directed at the system administrator, then it would be nice if there were some more meaningful way to show the namespace that is affected than just printing the hex address of the kernel structure.
As the sysadmin for my test systems, printing the hex address is mildly annoying ... I now have to add a new case to my scripts that look at dmesg output for unusual activity.
Is there some better "name for a namespace" than the address? Perhaps the process id of the process that instantiated the namespace???
Quoted 16 lines
Quoted 6 lines
Quoted 3 lines
I agree with Tony here. Aside from the nuisance it is to see that message on console every time I unshare a namespace, a printk doesn't seem like the right way to output the info.
But you agree that this is happening only because you're doing tests related to namespaces, right?
Yup :)
Quoted 7 lines
I don't think that in a "standard" configuration this will happen very frequently, but may be I'm wrong.
Quoted 2 lines
At most I'd say an audit
message.That's a good idea. Thanks, Serge. I'll do that.
I'm not familiar with kernel policies regarding audit messages. Are
audit messages treated anything like kernel interfaces when it comes to removing/changing them?
Cheers,
-Matt Helsley
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
A message that is not in the archive (sent off-list or not yet received): 20080506180527.GA8315-6s5zFf/[email protected]
Re: [PATCH 1/8] Scaling msgmni to the amount of lowmem
Quoted 16 lines · Serge E. Hallyn
Quoted 14 lines · Luck, Tony
Quoted 5 lines
Well, this printk had been suggested by somebody (sorry I don't remember who) when I first submitted the patch. Actually I think it might be useful for a sysadmin to be aware of a change in the msgmni value: we have the message not only at boot time, but also each time msgmni is recomputed because of a change in the amount of memory.
If the message is directed at the system administrator, then it would be nice if there were some more meaningful way to show the namespace that is affected than just printing the hex address of the kernel structure.
As the sysadmin for my test systems, printing the hex address is mildly annoying ... I now have to add a new case to my scripts that look at dmesg output for unusual activity.
Quoted 7 lines
Quoted 2 lines
Is there some better "name for a namespace" than the address? Perhaps the process id of the process that instantiated the namespace???
I agree with Tony here. Aside from the nuisance it is to see that message on console every time I unshare a namespace, a printk doesn't seem like the right way to output the info.
But you agree that this is happening only because you're doing tests related to namespaces, right?
I don't think that in a "standard" configuration this will happen very frequently, but may be I'm wrong.
Quoted 3 lines
At most I'd say an audit
message.
That's a good idea. Thanks, Serge. I'll do that.
Regards,
Nadia
Re: [PATCH 1/8] Scaling msgmni to the amount of lowmem
In reply to Luck, TonyQuoted 7 lines · Tony
Quoted 1 line
Well, this printk had been suggested by somebody (sorry I don't remember who) when I first submitted the patch. Actually I think it might be useful for a sysadmin to be aware of a change in the msgmni value: we have the message not only at boot time, but also each time msgmni is recomputed because of a change in the amount of memory.
If the message is directed at the system administrator, then it would be nice if there were some more meaningful way to show the namespace that is affected than just printing the hex address of the kernel structure.
Quoted 7 lines
As the sysadmin for my test systems, printing the hex address is mildly annoying ... I now have to add a new case to my scripts that look at dmesg output for unusual activity.
Is there some better "name for a namespace" than the address? Perhaps the process id of the process that instantiated the namespace???
Unfortunately no when we are inside an ipc namespace, we don't have such interesting informations. But I agree with you, an address is not readable enough. I'll try to find a solution.
Regards,
Nadia
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
A message that is not in the archive (sent off-list or not yet received): 481EC917.6070808-6ktuUTfB/[email protected]
RE: [PATCH 1/8] Scaling msgmni to the amount of lowmem
Quoted 5 lines
Well, this printk had been suggested by somebody (sorry I don't remember who) when I first submitted the patch. Actually I think it might be useful for a sysadmin to be aware of a change in the msgmni value: we have the message not only at boot time, but also each time msgmni is recomputed because of a change in the amount of memory.
If the message is directed at the system administrator, then it would be nice if there were some more meaningful way to show the namespace that is affected than just printing the hex address of the kernel structure.
As the sysadmin for my test systems, printing the hex address is mildly annoying ... I now have to add a new case to my scripts that look at dmesg output for unusual activity.
Is there some better "name for a namespace" than the address? Perhaps the process id of the process that instantiated the namespace???
-Tony
A message that is not in the archive (sent off-list or not yet received): 12c511ca0804291328v2f0b87csd0f2cf3accc6ad00-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Re: [PATCH 1/8] Scaling msgmni to the amount of lowmem
Quoted 21 lines · Tony Luck
Quoted 4 lines · On Mon, Feb 11, 2008 at 7:16 AM, <Nadia.Derbey-6ktuUTfB/[email protected]>…
Index:
linux-2.6.24-mm1/ipc/msg.c
===================================================================ipc/msg.c 2008-02-07 15:24:19.000000000 +0100 renamed from ipc/msg.c 2008-02-07 15:02:29.000000000 +0100 +0
-0...
ipc/msg.c 2008-02-07 15:24:19.000000000 +0100
Quoted 5 lines
ipc/msg.c 2008-02-07 15:24:19.000000000 +0100 renamed from ipc/msg.c 2008-02-07 15:02:29.000000000 +0100 +5
-0+out_callback: + + printk(KERN_INFO "msgmni has been set to %d for ipc namespace %p\n", + ns->msg_ctlmni, ns); +}This patch has now made its way to mainline. I can see how this printk was really useful to you while developing this patch. But does it add much value in a production system? It just looks like another piece of clutter on the console to my uncontainerized eyes.
Quoted 3 lines
-Tony
Well, this printk had been suggested by somebody (sorry I don't remember who) when I first submitted the patch. Actually I think it might be useful for a sysadmin to be aware of a change in the msgmni value: we have the message not only at boot time, but also each time msgmni is recomputed because of a change in the amount of memory. Also, at boot time, I think it's interesting to have the actual msgmni
value: it used to unconditionally be set to 16. Some applications that used to need an initialization script setting msgmni to a higher value might not need that script anymore, since the new value might fit their needs.
Regards,
Nadia
A message that is not in the archive (sent off-list or not yet received): 20080211141813.354484000-6ktuUTfB/[email protected]
Re: [PATCH 1/8] Scaling msgmni to the amount of lowmem
Quoted 4 lines · On Mon, Feb 11, 2008 at 7:16 AM, <Nadia.Derbey-6ktuUTfB/[email protected]>…
Index:
linux-2.6.24-mm1/ipc/msg.c
===================================================================
---linux-2.6.24-mm1.orig/ipc/msg.c2008-02-07 15:02:29.000000000 +0100
+++linux-2.6.24-mm1/ipc/msg.c2008-02-07 15:24:19.000000000 +0100
...
Quoted 5 lines
+out_callback:
+
+ printk(KERN_INFO "msgmni has been set to %d for ipc namespace %p\n",
+ns->msg_ctlmni, ns);
+}
This patch has now made its way to mainline. I can see how this printk was really useful to you while developing this patch. But does it add much value in a production system? It just looks like another piece of clutter on the console to my uncontainerized eyes.
-Tony
PATCH 1/8 Scaling msgmni to the amount of lowmem
In reply to [email protected][PATCH 01/08]
This patch computes msg_ctlmni to make it scale with the amount of lowmem. msg_ctlmni is now set to make the message queues occupy 1/32 of the available lowmem.
Some cleaning has also been done for the MSGPOOL constant: the msgctl man page says it's not used, but it also defines it as a size in bytes (the code expresses it in Kbytes).
--- include/linux/msg.h | 14 ++++++++++++-- ipc/msg.c | 37 ++++++++++++++++++++++++++++++++++++- 2 files changed, 48 insertions(+), 3 deletions(-)
include/linux/msg.h +12 -2
@@ -49,16 +49,26 @@ struct msginfo {unsigned short msgseg; }; +/* +* Scaling factor to compute msgmni: +* the memory dedicated to msg queues (msgmni * msgmnb) should occupy +* at most 1/MSG_MEM_SCALE of the lowmem (see the formula in ipc/msg.c): +* up to 8MB : msgmni = 16 (MSGMNI) +* 4 GB : msgmni = 8K +* more than 16 GB : msgmni = 32K (IPCMNI) +*/ +#define MSG_MEM_SCALE 32 +#define MSGMNI 16/* <= IPCMNI */ /* max # of msg queue identifiers */ #define MSGMAX 8192/* <= INT_MAX */ /* max size of message (bytes) */ #define MSGMNB 16384/* <= INT_MAX */ /* default max size of a message queue */ /* unused */ -#define MSGPOOL (MSGMNI*MSGMNB/1024)/* size in kilobytes of message pool */ +#define MSGPOOL (MSGMNI * MSGMNB)/* size in bytes of message pool */ #define MSGTQL MSGMNB/* number of system message headers */ #define MSGMAP MSGMNB/* number of entries in message map */ #define MSGSSZ 16/* message segment size */ -#define __MSGSEG ((MSGPOOL*1024)/ MSGSSZ)/* max no. of segments */ +#define __MSGSEG (MSGPOOL / MSGSSZ)/* max no. of segments */ #define MSGSEG (__MSGSEG <= 0xffff ? __MSGSEG : 0xffff)#ifdef __KERNEL__
ipc/msg.c +36 -1
@@ -27,6 +27,7 @@#include <linux/msg.h> #include <linux/spinlock.h> #include <linux/init.h> +#include <linux/mm.h> #include <linux/proc_fs.h> #include <linux/list.h> #include <linux/security.h>
@@ -78,11 +79,45 @@ static int newque(struct ipc_namespace *static int sysvipc_msg_proc_show (struct seq_file *s,void *it);#endif +/* +* Scale msgmni with the available lowmem size: the memory dedicated to msg +* queues should occupy at most 1/MSG_MEM_SCALE of lowmem. +* This should be done staying within the (MSGMNI , IPCMNI) range. +*/ +static void recompute_msgmni (struct ipc_namespace *ns) +{ +struct sysinfo i; +unsigned long allowed; + +si_meminfo (&i); + allowed = (((i.totalram - i.totalhigh) /MSG_MEM_SCALE ) * i.mem_unit) + /MSGMNB ; + +if (allowed <MSGMNI ) { + ns->msg_ctlmni =MSGMNI ; + goto out_callback; + } + +if (allowed >IPCMNI ) { + ns->msg_ctlmni =IPCMNI ; + goto out_callback; + } + + 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) { ns->msg_ctlmax =MSGMAX ; ns->msg_ctlmnb =MSGMNB ; - ns->msg_ctlmni =MSGMNI ; + +recompute_msgmni (ns); +atomic_set (&ns->msg_bytes,0 );atomic_set (&ns->msg_hdrs,0 );ipc_init_ids (&ns->ids[IPC_MSG_IDS ]);
--
PATCH 2/8 Scaling msgmni to the number of ipc namespaces
In reply to [email protected][PATCH 02/08]
Since all the namespaces see the same amount of memory (the total one) this patch introduces a new variable that counts the ipc namespaces and divides msg_ctlmni by this counter.
--- include/linux/ipc_namespace.h | 1 + ipc/msg.c | 10 +++++++--- ipc/namespace.c | 3 +++ ipc/util.c | 3 +++ 4 files changed, 14 insertions(+), 3 deletions(-)
include/linux/ipc_namespace.h +1 -0
@@ -33,6 +33,7 @@ struct ipc_namespace { };extern struct ipc_namespace init_ipc_ns; +extern atomic_t nr_ipc_ns;#ifdef CONFIG_SYSVIPC #define INIT_IPC_NS (ns) .ns = &init_ipc_ns,
ipc/util.c +3 -0
@@ -52,6 +52,9 @@ struct ipc_namespace init_ipc_ns = { }, }; +atomic_t nr_ipc_ns =ATOMIC_INIT (1 ); + +/** * ipc_init - initialise IPC subsystem *
ipc/namespace.c +3 -0
@@ -20,6 +20,8 @@ static struct ipc_namespace *clone_ipc_nif (ns ==NULL )return ERR_PTR (-ENOMEM ); +atomic_inc (&nr_ipc_ns); +sem_init_ns (ns);msg_init_ns (ns);shm_init_ns (ns);
@@ -83,4 +85,5 @@ void free_ipc_ns(struct kref *kref)msg_exit_ns (ns);shm_exit_ns (ns);kfree (ns); +atomic_dec (&nr_ipc_ns); }
ipc/msg.c +7 -3
@@ -82,24 +82,28 @@ static int sysvipc_msg_proc_show(struct/* * Scale msgmni with the available lowmem size: the memory dedicated to msg * queues should occupy at most 1/MSG_MEM_SCALE of lowmem. -* This should be done staying within the (MSGMNI , IPCMNI) range. +* Also take into account the number of nsproxies created so far. +* This should be done staying within the (MSGMNI , IPCMNI/nr_ipc_ns) range. */ static void recompute_msgmni (struct ipc_namespace *ns) {struct sysinfo i;unsigned long allowed; +int nb_ns;si_meminfo (&i); allowed = (((i.totalram - i.totalhigh) /MSG_MEM_SCALE ) * i.mem_unit) /MSGMNB ; + nb_ns =atomic_read (&nr_ipc_ns); + allowed /= nb_ns;if (allowed <MSGMNI ) { ns->msg_ctlmni =MSGMNI ; goto out_callback; } -if (allowed >IPCMNI ) { - ns->msg_ctlmni =IPCMNI ; +if (allowed >IPCMNI / nb_ns) { + ns->msg_ctlmni =IPCMNI / nb_ns; goto out_callback; }
--
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH 2/8 Scaling msgmni to the number of ipc namespaces
In reply to [email protected][PATCH 02/08]
Since all the namespaces see the same amount of memory (the total one) this patch introduces a new variable that counts the ipc namespaces and divides msg_ctlmni by this counter.
--- include/linux/ipc_namespace.h | 1 + ipc/msg.c | 10 +++++++--- ipc/namespace.c | 3 +++ ipc/util.c | 3 +++ 4 files changed, 14 insertions(+), 3 deletions(-)
include/linux/ipc_namespace.h +1 -0
@@ -33,6 +33,7 @@ struct ipc_namespace { };extern struct ipc_namespace init_ipc_ns; +extern atomic_t nr_ipc_ns;#ifdef CONFIG_SYSVIPC #define INIT_IPC_NS (ns) .ns = &init_ipc_ns,
ipc/util.c +3 -0
@@ -52,6 +52,9 @@ struct ipc_namespace init_ipc_ns = { }, }; +atomic_t nr_ipc_ns =ATOMIC_INIT (1 ); + +/** * ipc_init - initialise IPC subsystem *
ipc/namespace.c +3 -0
@@ -20,6 +20,8 @@ static struct ipc_namespace *clone_ipc_nif (ns ==NULL )return ERR_PTR (-ENOMEM ); +atomic_inc (&nr_ipc_ns); +sem_init_ns (ns);msg_init_ns (ns);shm_init_ns (ns);
@@ -83,4 +85,5 @@ void free_ipc_ns(struct kref *kref)msg_exit_ns (ns);shm_exit_ns (ns);kfree (ns); +atomic_dec (&nr_ipc_ns); }
ipc/msg.c +7 -3
@@ -82,24 +82,28 @@ static int sysvipc_msg_proc_show(struct/* * Scale msgmni with the available lowmem size: the memory dedicated to msg * queues should occupy at most 1/MSG_MEM_SCALE of lowmem. -* This should be done staying within the (MSGMNI , IPCMNI) range. +* Also take into account the number of nsproxies created so far. +* This should be done staying within the (MSGMNI , IPCMNI/nr_ipc_ns) range. */ static void recompute_msgmni (struct ipc_namespace *ns) {struct sysinfo i;unsigned long allowed; +int nb_ns;si_meminfo (&i); allowed = (((i.totalram - i.totalhigh) /MSG_MEM_SCALE ) * i.mem_unit) /MSGMNB ; + nb_ns =atomic_read (&nr_ipc_ns); + allowed /= nb_ns;if (allowed <MSGMNI ) { ns->msg_ctlmni =MSGMNI ; goto out_callback; } -if (allowed >IPCMNI ) { - ns->msg_ctlmni =IPCMNI ; +if (allowed >IPCMNI / nb_ns) { + ns->msg_ctlmni =IPCMNI / nb_ns; goto out_callback; }
--
PATCH 3/8 Defining the slab_memory_callback priority as a constant
In reply to [email protected][PATCH 03/08]
This is a trivial patch that defines the priority of slab_memory_callback in the callback chain as a constant.
This is to prepare for next patch in the series.
--- include/linux/memory.h | 6 ++++++ mm/slub.c | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-)
include/linux/memory.h +6 -0
@@ -53,6 +53,12 @@ struct memory_notify {struct notifier_block ;struct mem_section ; +/* +* Priorities for the hotplug memory callback routines (stored in decreasing +* order in the callback chain) +*/ +#define SLAB_CALLBACK_PRI 1 +#ifndef CONFIG_MEMORY_HOTPLUG_SPARSE static inline int memory_dev_init (void ) {
mm/slub.c +1 -1
@@ -3001,7 +3001,7 @@ void __init kmem_cache_init(void) kmalloc_caches[0 ].refcount =-1 ; caches++; -hotplug_memory_notifier (slab_memory_callback,1 ); +hotplug_memory_notifier (slab_memory_callback,SLAB_CALLBACK_PRI );#endif /* Able to allocate the per node structures */
--
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH 3/8 Defining the slab_memory_callback priority as a constant
In reply to [email protected][PATCH 03/08]
This is a trivial patch that defines the priority of slab_memory_callback in the callback chain as a constant.
This is to prepare for next patch in the series.
--- include/linux/memory.h | 6 ++++++ mm/slub.c | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-)
include/linux/memory.h +6 -0
@@ -53,6 +53,12 @@ struct memory_notify {struct notifier_block ;struct mem_section ; +/* +* Priorities for the hotplug memory callback routines (stored in decreasing +* order in the callback chain) +*/ +#define SLAB_CALLBACK_PRI 1 +#ifndef CONFIG_MEMORY_HOTPLUG_SPARSE static inline int memory_dev_init (void ) {
mm/slub.c +1 -1
@@ -3001,7 +3001,7 @@ void __init kmem_cache_init(void) kmalloc_caches[0 ].refcount =-1 ; caches++; -hotplug_memory_notifier (slab_memory_callback,1 ); +hotplug_memory_notifier (slab_memory_callback,SLAB_CALLBACK_PRI );#endif /* Able to allocate the per node structures */
--
PATCH 4/8 Recomputing msgmni on memory add / remove
In reply to [email protected][PATCH 04/08]
This patch introduces the registration of a callback routine that recomputes msg_ctlmni upon memory add / remove.
A single notifier block is registered in the hotplug memory chain for all the ipc namespaces.
Since the ipc namespaces are not linked together, they have their own notification chain: one notifier_block is defined per ipc namespace.
Each time an ipc namespace is created (removed) it registers (unregisters) its notifier block in (from) the ipcns chain.
The callback routine registered in the memory chain invokes the ipcns notifier chain with the IPCNS_LOWMEM event.
Each callback routine registered in the ipcns namespace, in turn, recomputes msgmni for the owning namespace.
--- include/linux/ipc_namespace.h | 43 ++++++++++++++++++++++++- include/linux/memory.h | 1 ipc/Makefile | 3 + ipc/ipcns_notifier.c | 71 ++++++++++++++++++++++++++++++++++++++++++ ipc/msg.c | 2 - ipc/namespace.c | 11 ++++++ ipc/util.c | 33 +++++++++++++++++++ ipc/util.h | 2 + 8 files changed, 162 insertions(+), 4 deletions(-)
include/linux/ipc_namespace.h +41 -2
@@ -4,6 +4,17 @@#include <linux/err.h> #include <linux/idr.h> #include <linux/rwsem.h> +#ifdef CONFIG_MEMORY_HOTPLUG +#include <linux/notifier.h> +#endif /* CONFIG_MEMORY_HOTPLUG */ + +/* +* ipc namespace events +*/ +#define IPCNS_MEMCHANGED 0x00000001/* Notify lowmem size changed */ + +#define IPCNS_CALLBACK_PRI 0 +struct ipc_ids {int in_use;
@@ -30,6 +41,10 @@ struct ipc_namespace {size_t shm_ctlall;int shm_ctlmni;int shm_tot; + +#ifdef CONFIG_MEMORY_HOTPLUG +struct notifier_block ipcns_nb; +#endif };extern struct ipc_namespace init_ipc_ns;
@@ -37,9 +52,33 @@ extern atomic_t nr_ipc_ns;#ifdef CONFIG_SYSVIPC #define INIT_IPC_NS (ns) .ns = &init_ipc_ns, -#else + +#ifdef CONFIG_MEMORY_HOTPLUG + +extern int register_ipcns_notifier (struct ipc_namespace *); +extern int unregister_ipcns_notifier (struct ipc_namespace *); +extern int ipcns_notify (unsigned long ); + +#else /* CONFIG_MEMORY_HOTPLUG */ + +static inline int register_ipcns_notifier (struct ipc_namespace *ipcns) +{ +return 0 ; +} +static inline int unregister_ipcns_notifier (struct ipc_namespace *ipcns) +{ +return 0 ; +} +static inline int ipcns_notify (unsigned long ev) +{ +return 0 ; +} + +#endif /* CONFIG_MEMORY_HOTPLUG */ + +#else /* CONFIG_SYSVIPC */ #define INIT_IPC_NS (ns) -#endif +#endif /* CONFIG_SYSVIPC */ #if defined(CONFIG_SYSVIPC ) && defined(CONFIG_IPC_NS )extern void free_ipc_ns (struct kref *kref);
include/linux/memory.h +1 -0
@@ -58,6 +58,7 @@ struct mem_section;* order in the callback chain) */ #define SLAB_CALLBACK_PRI 1 +#define IPC_CALLBACK_PRI 10#ifndef CONFIG_MEMORY_HOTPLUG_SPARSE static inline int memory_dev_init (void )
ipc/ipcns_notifier.c new file +71 -0
71 lines not on this page · raw message
ipc/Makefile +2 -1
@@ -3,7 +3,8 @@ # obj-$(CONFIG_SYSVIPC_COMPAT) += compat.o -obj-$(CONFIG_SYSVIPC) += util.o msgutil.o msg.o sem.o shm.o +obj_mem-$(CONFIG_MEMORY_HOTPLUG) += ipcns_notifier.o +obj-$(CONFIG_SYSVIPC) += util.o msgutil.o msg.o sem.o shm.o $(obj_mem-y) obj-$(CONFIG_SYSVIPC_SYSCTL) += ipc_sysctl.o obj_mq-$(CONFIG_COMPAT) += compat_mq.o obj-$(CONFIG_POSIX_MQUEUE) += mqueue.o msgutil.o $(obj_mq-y)
ipc/util.c +33 -0
@@ -33,6 +33,7 @@#include <linux/audit.h> #include <linux/nsproxy.h> #include <linux/rwsem.h> +#include <linux/memory.h> #include <linux/ipc_namespace.h> #include <asm/unistd.h>
@@ -55,11 +56,41 @@ struct ipc_namespace init_ipc_ns = {atomic_t nr_ipc_ns =ATOMIC_INIT (1 ); +#ifdef CONFIG_MEMORY_HOTPLUG + +static int ipc_memory_callback (struct notifier_block *self, +unsigned long action,void *arg) +{ +switch (action) { +case MEM_ONLINE :/* memory successfully brought online */ +case MEM_OFFLINE :/* or offline: it's time to recompute msgmni */ +/* +* This is done by invoking the ipcns notifier chain with the +* IPC_MEMCHANGED event. +*/ +ipcns_notify (IPCNS_MEMCHANGED ); +break ; +case MEM_GOING_ONLINE : +case MEM_GOING_OFFLINE : +case MEM_CANCEL_ONLINE : +case MEM_CANCEL_OFFLINE : +default : +break ; + } + +return NOTIFY_OK ; +} + +#endif /* CONFIG_MEMORY_HOTPLUG */ +/** * ipc_init - initialise IPC subsystem * * The various system5 IPC resources (semaphores, messages and shared * memory) are initialised +* A callback routine is registered into the memory hotplug notifier +* chain: since msgmni scales to lowmem this callback routine will be +* called upon successful memory add / remove to recompute msmgni. */ static int __init ipc_init (void )
@@ -67,6 +98,8 @@ static int __init ipc_init(void)sem_init ();msg_init ();shm_init (); +hotplug_memory_notifier (ipc_memory_callback,IPC_CALLBACK_PRI ); +register_ipcns_notifier (&init_ipc_ns);return 0 ; }__initcall (ipc_init);
ipc/namespace.c +11 -0
@@ -26,6 +26,8 @@ static struct ipc_namespace *clone_ipc_nmsg_init_ns (ns);shm_init_ns (ns); +register_ipcns_notifier (ns); +kref_init (&ns->kref);return ns; }
@@ -81,6 +83,15 @@ void free_ipc_ns(struct kref *kref)struct ipc_namespace *ns; ns = container_of(kref, struct ipc_namespace, kref); +/* +* Unregistering the hotplug notifier at the beginning guarantees +* that the ipc namespace won't be freed while we are inside the +* callback routine. Since the blocking_notifier_chain_XXX routines +* hold a rw lock on the notifier list, unregister_ipcns_notifier() +* won't take the rw lock before blocking_notifier_call_chain() has +* released the rd lock. +*/ +unregister_ipcns_notifier (ns);sem_exit_ns (ns);msg_exit_ns (ns);shm_exit_ns (ns);
ipc/msg.c +1 -1
@@ -85,7 +85,7 @@ static int sysvipc_msg_proc_show(struct* Also take into account the number of nsproxies created so far. * This should be done staying within the (MSGMNI , IPCMNI/nr_ipc_ns) range. */ -static void recompute_msgmni (struct ipc_namespace *ns) +void recompute_msgmni (struct ipc_namespace *ns) {struct sysinfo i;unsigned long allowed;
ipc/util.h +2 -0
@@ -124,6 +124,8 @@ extern void free_msg(struct msg_msg *msgextern struct msg_msg *load_msg (const void __user *src,int len);extern int store_msg (void __user *dest,struct msg_msg *msg,int len); +extern void recompute_msgmni (struct ipc_namespace *); +static inline int ipc_buildid (int id,int seq) {return SEQ_MULTIPLIER * seq + id;
--
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH 4/8 Recomputing msgmni on memory add / remove
In reply to [email protected][PATCH 04/08]
This patch introduces the registration of a callback routine that recomputes msg_ctlmni upon memory add / remove.
A single notifier block is registered in the hotplug memory chain for all the ipc namespaces.
Since the ipc namespaces are not linked together, they have their own notification chain: one notifier_block is defined per ipc namespace.
Each time an ipc namespace is created (removed) it registers (unregisters) its notifier block in (from) the ipcns chain.
The callback routine registered in the memory chain invokes the ipcns notifier chain with the IPCNS_LOWMEM event.
Each callback routine registered in the ipcns namespace, in turn, recomputes msgmni for the owning namespace.
--- include/linux/ipc_namespace.h | 43 ++++++++++++++++++++++++- include/linux/memory.h | 1 ipc/Makefile | 3 + ipc/ipcns_notifier.c | 71 ++++++++++++++++++++++++++++++++++++++++++ ipc/msg.c | 2 - ipc/namespace.c | 11 ++++++ ipc/util.c | 33 +++++++++++++++++++ ipc/util.h | 2 + 8 files changed, 162 insertions(+), 4 deletions(-)
include/linux/ipc_namespace.h +41 -2
@@ -4,6 +4,17 @@#include <linux/err.h> #include <linux/idr.h> #include <linux/rwsem.h> +#ifdef CONFIG_MEMORY_HOTPLUG +#include <linux/notifier.h> +#endif /* CONFIG_MEMORY_HOTPLUG */ + +/* +* ipc namespace events +*/ +#define IPCNS_MEMCHANGED 0x00000001/* Notify lowmem size changed */ + +#define IPCNS_CALLBACK_PRI 0 +struct ipc_ids {int in_use;
@@ -30,6 +41,10 @@ struct ipc_namespace {size_t shm_ctlall;int shm_ctlmni;int shm_tot; + +#ifdef CONFIG_MEMORY_HOTPLUG +struct notifier_block ipcns_nb; +#endif };extern struct ipc_namespace init_ipc_ns;
@@ -37,9 +52,33 @@ extern atomic_t nr_ipc_ns;#ifdef CONFIG_SYSVIPC #define INIT_IPC_NS (ns) .ns = &init_ipc_ns, -#else + +#ifdef CONFIG_MEMORY_HOTPLUG + +extern int register_ipcns_notifier (struct ipc_namespace *); +extern int unregister_ipcns_notifier (struct ipc_namespace *); +extern int ipcns_notify (unsigned long ); + +#else /* CONFIG_MEMORY_HOTPLUG */ + +static inline int register_ipcns_notifier (struct ipc_namespace *ipcns) +{ +return 0 ; +} +static inline int unregister_ipcns_notifier (struct ipc_namespace *ipcns) +{ +return 0 ; +} +static inline int ipcns_notify (unsigned long ev) +{ +return 0 ; +} + +#endif /* CONFIG_MEMORY_HOTPLUG */ + +#else /* CONFIG_SYSVIPC */ #define INIT_IPC_NS (ns) -#endif +#endif /* CONFIG_SYSVIPC */ #if defined(CONFIG_SYSVIPC ) && defined(CONFIG_IPC_NS )extern void free_ipc_ns (struct kref *kref);
include/linux/memory.h +1 -0
@@ -58,6 +58,7 @@ struct mem_section;* order in the callback chain) */ #define SLAB_CALLBACK_PRI 1 +#define IPC_CALLBACK_PRI 10#ifndef CONFIG_MEMORY_HOTPLUG_SPARSE static inline int memory_dev_init (void )
ipc/ipcns_notifier.c new file +71 -0
71 lines not on this page · raw message
ipc/Makefile +2 -1
@@ -3,7 +3,8 @@ # obj-$(CONFIG_SYSVIPC_COMPAT) += compat.o -obj-$(CONFIG_SYSVIPC) += util.o msgutil.o msg.o sem.o shm.o +obj_mem-$(CONFIG_MEMORY_HOTPLUG) += ipcns_notifier.o +obj-$(CONFIG_SYSVIPC) += util.o msgutil.o msg.o sem.o shm.o $(obj_mem-y) obj-$(CONFIG_SYSVIPC_SYSCTL) += ipc_sysctl.o obj_mq-$(CONFIG_COMPAT) += compat_mq.o obj-$(CONFIG_POSIX_MQUEUE) += mqueue.o msgutil.o $(obj_mq-y)
ipc/util.c +33 -0
@@ -33,6 +33,7 @@#include <linux/audit.h> #include <linux/nsproxy.h> #include <linux/rwsem.h> +#include <linux/memory.h> #include <linux/ipc_namespace.h> #include <asm/unistd.h>
@@ -55,11 +56,41 @@ struct ipc_namespace init_ipc_ns = {atomic_t nr_ipc_ns =ATOMIC_INIT (1 ); +#ifdef CONFIG_MEMORY_HOTPLUG + +static int ipc_memory_callback (struct notifier_block *self, +unsigned long action,void *arg) +{ +switch (action) { +case MEM_ONLINE :/* memory successfully brought online */ +case MEM_OFFLINE :/* or offline: it's time to recompute msgmni */ +/* +* This is done by invoking the ipcns notifier chain with the +* IPC_MEMCHANGED event. +*/ +ipcns_notify (IPCNS_MEMCHANGED ); +break ; +case MEM_GOING_ONLINE : +case MEM_GOING_OFFLINE : +case MEM_CANCEL_ONLINE : +case MEM_CANCEL_OFFLINE : +default : +break ; + } + +return NOTIFY_OK ; +} + +#endif /* CONFIG_MEMORY_HOTPLUG */ +/** * ipc_init - initialise IPC subsystem * * The various system5 IPC resources (semaphores, messages and shared * memory) are initialised +* A callback routine is registered into the memory hotplug notifier +* chain: since msgmni scales to lowmem this callback routine will be +* called upon successful memory add / remove to recompute msmgni. */ static int __init ipc_init (void )
@@ -67,6 +98,8 @@ static int __init ipc_init(void)sem_init ();msg_init ();shm_init (); +hotplug_memory_notifier (ipc_memory_callback,IPC_CALLBACK_PRI ); +register_ipcns_notifier (&init_ipc_ns);return 0 ; }__initcall (ipc_init);
ipc/namespace.c +11 -0
@@ -26,6 +26,8 @@ static struct ipc_namespace *clone_ipc_nmsg_init_ns (ns);shm_init_ns (ns); +register_ipcns_notifier (ns); +kref_init (&ns->kref);return ns; }
@@ -81,6 +83,15 @@ void free_ipc_ns(struct kref *kref)struct ipc_namespace *ns; ns = container_of(kref, struct ipc_namespace, kref); +/* +* Unregistering the hotplug notifier at the beginning guarantees +* that the ipc namespace won't be freed while we are inside the +* callback routine. Since the blocking_notifier_chain_XXX routines +* hold a rw lock on the notifier list, unregister_ipcns_notifier() +* won't take the rw lock before blocking_notifier_call_chain() has +* released the rd lock. +*/ +unregister_ipcns_notifier (ns);sem_exit_ns (ns);msg_exit_ns (ns);shm_exit_ns (ns);
ipc/msg.c +1 -1
@@ -85,7 +85,7 @@ static int sysvipc_msg_proc_show(struct* Also take into account the number of nsproxies created so far. * This should be done staying within the (MSGMNI , IPCMNI/nr_ipc_ns) range. */ -static void recompute_msgmni (struct ipc_namespace *ns) +void recompute_msgmni (struct ipc_namespace *ns) {struct sysinfo i;unsigned long allowed;
ipc/util.h +2 -0
@@ -124,6 +124,8 @@ extern void free_msg(struct msg_msg *msgextern struct msg_msg *load_msg (const void __user *src,int len);extern int store_msg (void __user *dest,struct msg_msg *msg,int len); +extern void recompute_msgmni (struct ipc_namespace *); +static inline int ipc_buildid (int id,int seq) {return SEQ_MULTIPLIER * seq + id;
--
PATCH 5/8 Invoke the ipcns notifier chain as a work item
In reply to [email protected][PATCH 05/08]
This patch makes the memory hotplug chain's mutex held for a shorter time:
when memory is offlined or onlined a work item is added to the global workqueue.
When the work item is run, it notifies the ipcns notifier chain with the IPCNS_MEMCHANGED event.
--- ipc/util.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
ipc/util.c +14 -1
@@ -58,6 +58,14 @@ atomic_t nr_ipc_ns = ATOMIC_INIT(1);#ifdef CONFIG_MEMORY_HOTPLUG +static void ipc_memory_notifier (struct work_struct *work) +{ +ipcns_notify (IPCNS_MEMCHANGED ); +} + +static DECLARE_WORK(ipc_memory_wq, ipc_memory_notifier); + +static int ipc_memory_callback (struct notifier_block *self,unsigned long action,void *arg) {
@@ -67,8 +75,13 @@ static int ipc_memory_callback(struct no/* * This is done by invoking the ipcns notifier chain with the * IPC_MEMCHANGED event. +* In order not to keep the lock on the hotplug memory chain +* for too long, queue a work item that will, when waken up, +* activate the ipcns notification chain. +* No need to keep several ipc work items on the queue. */ -ipcns_notify (IPCNS_MEMCHANGED ); +if (!work_pending (&ipc_memory_wq)) +schedule_work (&ipc_memory_wq);break ;case MEM_GOING_ONLINE :case MEM_GOING_OFFLINE :
--
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH 5/8 Invoke the ipcns notifier chain as a work item
In reply to [email protected][PATCH 05/08]
This patch makes the memory hotplug chain's mutex held for a shorter time:
when memory is offlined or onlined a work item is added to the global workqueue.
When the work item is run, it notifies the ipcns notifier chain with the IPCNS_MEMCHANGED event.
--- ipc/util.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
ipc/util.c +14 -1
@@ -58,6 +58,14 @@ atomic_t nr_ipc_ns = ATOMIC_INIT(1);#ifdef CONFIG_MEMORY_HOTPLUG +static void ipc_memory_notifier (struct work_struct *work) +{ +ipcns_notify (IPCNS_MEMCHANGED ); +} + +static DECLARE_WORK(ipc_memory_wq, ipc_memory_notifier); + +static int ipc_memory_callback (struct notifier_block *self,unsigned long action,void *arg) {
@@ -67,8 +75,13 @@ static int ipc_memory_callback(struct no/* * This is done by invoking the ipcns notifier chain with the * IPC_MEMCHANGED event. +* In order not to keep the lock on the hotplug memory chain +* for too long, queue a work item that will, when waken up, +* activate the ipcns notification chain. +* No need to keep several ipc work items on the queue. */ -ipcns_notify (IPCNS_MEMCHANGED ); +if (!work_pending (&ipc_memory_wq)) +schedule_work (&ipc_memory_wq);break ;case MEM_GOING_ONLINE :case MEM_GOING_OFFLINE :
--
PATCH 6/8 Recomputing msgmni on ipc namespace creation/removal
In reply to [email protected][PATCH 06/08]
This patch introduces a notification mechanism that aims at recomputing msgmni each time an ipc namespace is created or removed.
The ipc namespace notifier chain already defined for memory hotplug management is used for that purpose too.
Each time a new ipc namespace is allocated or an existing ipc namespace is removed, the ipcns notifier chain is notified. The callback routine for each registered ipc namespace is then activated in order to recompute msgmni for that namespace.
--- include/linux/ipc_namespace.h | 25 ++----------------------- ipc/Makefile | 3 +-- ipc/ipcns_notifier.c | 2 ++ ipc/namespace.c | 12 ++++++++++++ 4 files changed, 17 insertions(+), 25 deletions(-)
include/linux/ipc_namespace.h +2 -23
@@ -4,14 +4,14 @@#include <linux/err.h> #include <linux/idr.h> #include <linux/rwsem.h> -#ifdef CONFIG_MEMORY_HOTPLUG #include <linux/notifier.h> -#endif /* CONFIG_MEMORY_HOTPLUG */ /* * ipc namespace events */ #define IPCNS_MEMCHANGED 0x00000001/* Notify lowmem size changed */ +#define IPCNS_CREATED 0x00000002/* Notify new ipc namespace created */ +#define IPCNS_REMOVED 0x00000003/* Notify ipc namespace removed */ #define IPCNS_CALLBACK_PRI 0
@@ -42,9 +42,7 @@ struct ipc_namespace {int shm_ctlmni;int shm_tot; -#ifdef CONFIG_MEMORY_HOTPLUG struct notifier_block ipcns_nb; -#endif };extern struct ipc_namespace init_ipc_ns;
@@ -53,29 +51,10 @@ extern atomic_t nr_ipc_ns;#ifdef CONFIG_SYSVIPC #define INIT_IPC_NS (ns) .ns = &init_ipc_ns, -#ifdef CONFIG_MEMORY_HOTPLUG -extern int register_ipcns_notifier (struct ipc_namespace *);extern int unregister_ipcns_notifier (struct ipc_namespace *);extern int ipcns_notify (unsigned long ); -#else /* CONFIG_MEMORY_HOTPLUG */ - -static inline int register_ipcns_notifier (struct ipc_namespace *ipcns) -{ -return 0 ; -} -static inline int unregister_ipcns_notifier (struct ipc_namespace *ipcns) -{ -return 0 ; -} -static inline int ipcns_notify (unsigned long ev) -{ -return 0 ; -} - -#endif /* CONFIG_MEMORY_HOTPLUG */ -#else /* CONFIG_SYSVIPC */ #define INIT_IPC_NS (ns)#endif /* CONFIG_SYSVIPC */
ipc/ipcns_notifier.c +2 -0
@@ -29,6 +29,8 @@ static int ipcns_callback(struct notifieswitch (action) {case IPCNS_MEMCHANGED :/* amount of lowmem has changed */ +case IPCNS_CREATED : +case IPCNS_REMOVED :/* * It's time to recompute msgmni */
ipc/Makefile +1 -2
@@ -3,8 +3,7 @@ # obj-$(CONFIG_SYSVIPC_COMPAT) += compat.o -obj_mem-$(CONFIG_MEMORY_HOTPLUG) += ipcns_notifier.o -obj-$(CONFIG_SYSVIPC) += util.o msgutil.o msg.o sem.o shm.o $(obj_mem-y) +obj-$(CONFIG_SYSVIPC) += util.o msgutil.o msg.o sem.o shm.o ipcns_notifier.o obj-$(CONFIG_SYSVIPC_SYSCTL) += ipc_sysctl.o obj_mq-$(CONFIG_COMPAT) += compat_mq.o obj-$(CONFIG_POSIX_MQUEUE) += mqueue.o msgutil.o $(obj_mq-y)
ipc/namespace.c +12 -0
@@ -26,6 +26,12 @@ static struct ipc_namespace *clone_ipc_nmsg_init_ns (ns);shm_init_ns (ns); +/* +* msgmni has already been computed for the new ipc ns. +* Thus, do the ipcns creation notification before registering that +* new ipcns in the chain. +*/ +ipcns_notify (IPCNS_CREATED );register_ipcns_notifier (ns);kref_init (&ns->kref);
@@ -97,4 +103,10 @@ void free_ipc_ns(struct kref *kref)shm_exit_ns (ns);kfree (ns);atomic_dec (&nr_ipc_ns); + +/* +* Do the ipcns removal notification after decrementing nr_ipc_ns in +* order to have a correct value when recomputing msgmni. +*/ +ipcns_notify (IPCNS_REMOVED ); }
--
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH 6/8 Recomputing msgmni on ipc namespace creation/removal
In reply to [email protected][PATCH 06/08]
This patch introduces a notification mechanism that aims at recomputing msgmni each time an ipc namespace is created or removed.
The ipc namespace notifier chain already defined for memory hotplug management is used for that purpose too.
Each time a new ipc namespace is allocated or an existing ipc namespace is removed, the ipcns notifier chain is notified. The callback routine for each registered ipc namespace is then activated in order to recompute msgmni for that namespace.
--- include/linux/ipc_namespace.h | 25 ++----------------------- ipc/Makefile | 3 +-- ipc/ipcns_notifier.c | 2 ++ ipc/namespace.c | 12 ++++++++++++ 4 files changed, 17 insertions(+), 25 deletions(-)
include/linux/ipc_namespace.h +2 -23
@@ -4,14 +4,14 @@#include <linux/err.h> #include <linux/idr.h> #include <linux/rwsem.h> -#ifdef CONFIG_MEMORY_HOTPLUG #include <linux/notifier.h> -#endif /* CONFIG_MEMORY_HOTPLUG */ /* * ipc namespace events */ #define IPCNS_MEMCHANGED 0x00000001/* Notify lowmem size changed */ +#define IPCNS_CREATED 0x00000002/* Notify new ipc namespace created */ +#define IPCNS_REMOVED 0x00000003/* Notify ipc namespace removed */ #define IPCNS_CALLBACK_PRI 0
@@ -42,9 +42,7 @@ struct ipc_namespace {int shm_ctlmni;int shm_tot; -#ifdef CONFIG_MEMORY_HOTPLUG struct notifier_block ipcns_nb; -#endif };extern struct ipc_namespace init_ipc_ns;
@@ -53,29 +51,10 @@ extern atomic_t nr_ipc_ns;#ifdef CONFIG_SYSVIPC #define INIT_IPC_NS (ns) .ns = &init_ipc_ns, -#ifdef CONFIG_MEMORY_HOTPLUG -extern int register_ipcns_notifier (struct ipc_namespace *);extern int unregister_ipcns_notifier (struct ipc_namespace *);extern int ipcns_notify (unsigned long ); -#else /* CONFIG_MEMORY_HOTPLUG */ - -static inline int register_ipcns_notifier (struct ipc_namespace *ipcns) -{ -return 0 ; -} -static inline int unregister_ipcns_notifier (struct ipc_namespace *ipcns) -{ -return 0 ; -} -static inline int ipcns_notify (unsigned long ev) -{ -return 0 ; -} - -#endif /* CONFIG_MEMORY_HOTPLUG */ -#else /* CONFIG_SYSVIPC */ #define INIT_IPC_NS (ns)#endif /* CONFIG_SYSVIPC */
ipc/ipcns_notifier.c +2 -0
@@ -29,6 +29,8 @@ static int ipcns_callback(struct notifieswitch (action) {case IPCNS_MEMCHANGED :/* amount of lowmem has changed */ +case IPCNS_CREATED : +case IPCNS_REMOVED :/* * It's time to recompute msgmni */
ipc/Makefile +1 -2
@@ -3,8 +3,7 @@ # obj-$(CONFIG_SYSVIPC_COMPAT) += compat.o -obj_mem-$(CONFIG_MEMORY_HOTPLUG) += ipcns_notifier.o -obj-$(CONFIG_SYSVIPC) += util.o msgutil.o msg.o sem.o shm.o $(obj_mem-y) +obj-$(CONFIG_SYSVIPC) += util.o msgutil.o msg.o sem.o shm.o ipcns_notifier.o obj-$(CONFIG_SYSVIPC_SYSCTL) += ipc_sysctl.o obj_mq-$(CONFIG_COMPAT) += compat_mq.o obj-$(CONFIG_POSIX_MQUEUE) += mqueue.o msgutil.o $(obj_mq-y)
ipc/namespace.c +12 -0
@@ -26,6 +26,12 @@ static struct ipc_namespace *clone_ipc_nmsg_init_ns (ns);shm_init_ns (ns); +/* +* msgmni has already been computed for the new ipc ns. +* Thus, do the ipcns creation notification before registering that +* new ipcns in the chain. +*/ +ipcns_notify (IPCNS_CREATED );register_ipcns_notifier (ns);kref_init (&ns->kref);
@@ -97,4 +103,10 @@ void free_ipc_ns(struct kref *kref)shm_exit_ns (ns);kfree (ns);atomic_dec (&nr_ipc_ns); + +/* +* Do the ipcns removal notification after decrementing nr_ipc_ns in +* order to have a correct value when recomputing msgmni. +*/ +ipcns_notify (IPCNS_REMOVED ); }
--
PATCH 7/8 Do not recompute msgmni anymore if explicitely set by user
In reply to [email protected][PATCH 07/08]
This patch makes msgmni not recomputed anymore upon ipc namespace creation / removal or memory add/remove, as soon as it has been set from userland.
As soon as msgmni is explicitely set via procfs or sysctl(), the associated callback routine is unregistered from the ipc namespace notifier chain.
--- ipc/ipc_sysctl.c | 43 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 41 insertions(+), 2 deletions(-)
ipc/ipc_sysctl.c +41 -2
@@ -35,6 +35,24 @@ static int proc_ipc_dointvec(ctl_table *return proc_dointvec (&ipc_table, write, filp, buffer, lenp, ppos); } +static int proc_ipc_callback_dointvec (ctl_table *table,int write, +struct file *filp,void __user *buffer,size_t *lenp,loff_t *ppos) +{ +size_t lenp_bef = *lenp; +int rc; + + rc =proc_ipc_dointvec (table, write, filp, buffer, lenp, ppos); + +if (write && !rc && lenp_bef == *lenp) +/* +* Tunable has successfully been changed from userland: +* disable its automatic recomputing. +*/ +unregister_ipcns_notifier (current->nsproxy->ipc_ns); + +return rc; +} +static int proc_ipc_doulongvec_minmax (ctl_table *table,int write,struct file *filp,void __user *buffer,size_t *lenp,loff_t *ppos) {
@@ -49,6 +67,7 @@ static int proc_ipc_doulongvec_minmax(ct#else #define proc_ipc_doulongvec_minmax NULL#define proc_ipc_dointvec NULL +#define proc_ipc_callback_dointvec NULL#endif #ifdef CONFIG_SYSCTL_SYSCALL
@@ -90,8 +109,28 @@ static int sysctl_ipc_data(ctl_table *ta }return 1 ; } + +static int sysctl_ipc_registered_data (ctl_table *table,int __user *name, +int nlen,void __user *oldval,size_t __user *oldlenp, +void __user *newval,size_t newlen) +{ +int rc; + + rc =sysctl_ipc_data (table, name, nlen, oldval, oldlenp, newval, + newlen); + +if (newval && newlen && rc >0 ) +/* +* Tunable has successfully been changed from userland: +* disable its automatic recomputing. +*/ +unregister_ipcns_notifier (current->nsproxy->ipc_ns); + +return rc; +}#else #define sysctl_ipc_data NULL +#define sysctl_ipc_registered_data NULL#endif static struct ctl_table ipc_kern_table[] = {
@@ -137,8 +176,8 @@ static struct ctl_table ipc_kern_table[] .data = &init_ipc_ns.msg_ctlmni, .maxlen = sizeof (init_ipc_ns.msg_ctlmni), .mode = 0644, - .proc_handler = proc_ipc_dointvec, - .strategy = sysctl_ipc_data, + .proc_handler = proc_ipc_callback_dointvec, + .strategy = sysctl_ipc_registered_data, }, { .ctl_name = KERN_MSGMNB,
--
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Andrew Morton
maintainerRe: [PATCH 7/8] Do not recompute msgmni anymore if explicitely set by user
Quoted 8 lines · On Mon, 11 Feb 2008 15:16:53 +0100 [email protected] wrote:
[PATCH 07/08]
This patch makes msgmni not recomputed anymore upon ipc namespace creation / removal or memory add/remove, as soon as it has been set from userland.
As soon as msgmni is explicitely set via procfs or
sysctl(), the associated callback routine is unregistered from the ipc namespace notifier chain.
The patch series looks pretty good.
Quoted 14 lines
===================================================================
ipc/ipc_sysctl.c +7
-0@@ -35,6 +35,24 @@ static int proc_ipc_dointvec(ctl_table *return proc_dointvec (&ipc_table, write, filp, buffer, lenp, ppos); } +static int proc_ipc_callback_dointvec (ctl_table *table,int write, +struct file *filp,void __user *buffer,size_t *lenp,loff_t *ppos) +{ +size_t lenp_bef = *lenp; +int rc; + + rc =proc_ipc_dointvec (table, write, filp, buffer, lenp, ppos);
ipc/ipc_sysctl.c static int proc_ipc_dointvec(ctl_table * · line 54
Quoted 10 lines
ipc/ipc_sysctl.c +10
-0+ +if (write && !rc && lenp_bef == *lenp) +/* +* Tunable has successfully been changed from userland: +* disable its automatic recomputing. +*/ +unregister_ipcns_notifier (current->nsproxy->ipc_ns); + +return rc; +}
If you haven't done so, could you please check that it all builds cleanly with CONFIG_PROCFS=n, and that all code which isn't needed if procfs is disabled is not present in the final binary?
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH 7/8] Do not recompute msgmni anymore if explicitely set by user
Quoted 38 lines · Andrew Morton
Quoted 8 lines · On Mon, 11 Feb 2008 15:16:53 +0100 [email protected] wrote:
[PATCH 07/08]
This patch makes msgmni not recomputed anymore upon ipc namespace creation / removal or memory add/remove, as soon as it has been set from userland.
As soon as msgmni is explicitely set via procfs or
sysctl(), the associated callback routine is unregistered from the ipc namespace notifier chain.The patch series looks pretty good.
Quoted 21 lines
===================================================================
ipc/ipc_sysctl.c +14
-0@@ -35,6 +35,24 @@ static int proc_ipc_dointvec(ctl_table *return proc_dointvec (&ipc_table, write, filp, buffer, lenp, ppos); } +static int proc_ipc_callback_dointvec (ctl_table *table,int write, +struct file *filp,void __user *buffer,size_t *lenp,loff_t *ppos) +{ +size_t lenp_bef = *lenp; +int rc; + + rc =proc_ipc_dointvec (table, write, filp, buffer, lenp, ppos); + +if (write && !rc && lenp_bef == *lenp) +/* +* Tunable has successfully been changed from userland: +* disable its automatic recomputing. +*/ +unregister_ipcns_notifier (current->nsproxy->ipc_ns);
Quoted 12 lines
ipc/ipc_sysctl.c static int proc_ipc_dointvec(ctl_table * · line 54
Quoted 3 lines
ipc/ipc_sysctl.c +3
-0+ +return rc; +}If you haven't done so, could you please check that it all builds cleanly with
CONFIG_PROCFS=n, and that all code which isn't needed if procfs is disabled is not present in the final binary?
Andrew,
it builds fine, modulo some changes in ipv4 and ipv6 (see attached patch - didn't find it in the hot fixes).
Regards,
Nadia
Fix header files to let IPV4 and IPV6 build if CONFIG_PROC_FS=n
--- include/net/ip_fib.h | 13 ++++++++++++- include/net/ipv6.h | 6 +++--- 2 files changed, 15 insertions(+), 4 deletions(-)
include/net/ip_fib.h +12 -1
@@ -266,6 +266,17 @@ static inline void fib_res_put(struct fi#ifdef CONFIG_PROC_FS extern int __net_init fib_proc_init (struct net *net); extern void __net_exit fib_proc_exit(struct net *net); -#endif +#else /* CONFIG_PROC_FS */ +static inline int fib_proc_init (struct net *net) +{ +return 0 ; +} + +static inline int fib_proc_exit (struct net *net) +{ +return 0 ; +} + +#endif /* CONFIG_PROC_FS */ #endif /* _NET_FIB_H */
include/net/ipv6.h +3 -3
@@ -586,9 +586,6 @@ extern int ip6_mc_msfget(struct sock *sk int __user *optlen);#ifdef CONFIG_PROC_FS -extern struct ctl_table *ipv6_icmp_sysctl_init (struct net *net); -extern struct ctl_table *ipv6_route_sysctl_init (struct net *net); -extern int ac6_proc_init (void );extern void ac6_proc_exit (void );extern int raw6_proc_init (void );
@@ -621,6 +618,9 @@ static inline int snmp6_unregister_dev(sextern ctl_table ipv6_route_table_template[];extern ctl_table ipv6_icmp_table_template[]; +extern struct ctl_table *ipv6_icmp_sysctl_init (struct net *net); +extern struct ctl_table *ipv6_route_sysctl_init (struct net *net); +extern int ipv6_sysctl_register (void );extern void ipv6_sysctl_unregister (void );#endif
Andrew Morton
maintainerRe: [PATCH 7/8] Do not recompute msgmni anymore if explicitely set by user
Quoted 2 lines · On Tue, 12 Feb 2008 10:32:31 +0100 Nadia Derbey…
it builds fine, modulo some changes in ipv4 and ipv6 (see attached patch
- didn't find it in the hot fixes).
OK, thanks for checking. Did you confirm that we don't have unneeded code in vmlinux when CONFIG_PROCFS=n? I guess before-and-after comparison of the size(1) output would tell us.
Those networking build problems appear to have already been fixed.
In future, please quote the compiler error output in the changelog when sending build fixes or warning fixes, thanks.
Re: [PATCH 7/8] Do not recompute msgmni anymore if explicitely set by user
Quoted 7 lines · Andrew Morton
Quoted 2 lines · On Tue, 12 Feb 2008 10:32:31 +0100 Nadia Derbey <[email protected]> wrote:
it builds fine, modulo some changes in ipv4 and ipv6 (see attached patch
- didn't find it in the hot fixes).
Quoted 11 lines
OK, thanks for checking. Did you confirm that we don't have unneeded code in vmlinux when
CONFIG_PROCFS=n? I guess before-and-after comparison of the size(1) output would tell us.Those networking build problems appear to have already been fixed.
In future, please quote the compiler error output in the changelog when sending build fixes or warning fixes, thanks.
BEFORE:
lkernel@akt$ size vmlinux text data bss dec hex filename 4318525 454484 462848 5235857 4fe491 vmlinux
AFTER:
lkernel@akt$ size vmlinux text data bss dec hex filename 4323161 454484 462848 5240493 4ff6ad vmlinux
which makes it +4636 = +0.11%
I've got the details for */built-in.o if needed.
Regards,
Nadia
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Andrew Morton
maintainerRe: [PATCH 7/8] Do not recompute msgmni anymore if explicitely set by user
Quoted 29 lines · On Tue, 12 Feb 2008 16:15:00 +0100 Nadia Derbey…
Quoted 7 lines · Andrew Morton
Quoted 2 lines · On Tue, 12 Feb 2008 10:32:31 +0100 Nadia Derbey…
it builds fine, modulo some changes in ipv4 and ipv6 (see attached patch
- didn't find it in the hot fixes).Quoted 11 lines
OK, thanks for checking. Did you confirm that we don't have unneeded code in vmlinux when
CONFIG_PROCFS=n? I guess before-and-after comparison of the size(1) output would tell us.Those networking build problems appear to have already been fixed.
In future, please quote the compiler error output in the changelog when sending build fixes or warning fixes, thanks.
BEFORE:
lkernel@akt$ size vmlinux text data bss dec hex filename 4318525 454484 462848 5235857 4fe491 vmlinuxAFTER:
Quoted 8 lines
lkernel@akt$ size vmlinux text data bss dec hex filename 4323161 454484 462848 5240493 4ff6ad vmlinuxwhich makes it +4636 = +0.11%
I've got the details for
*/built-in.oif needed.
That seems to be a lot of increase. Are you sure you had CONFIG_PROCFS=n in both cases? If so, the patch must have added a lot of code which will never be executed?
Re: [PATCH 7/8] Do not recompute msgmni anymore if explicitely set by user
Quoted 41 lines · Andrew Morton
Quoted 37 lines · On Tue, 12 Feb 2008 16:15:00 +0100 Nadia Derbey <[email protected]> wrote:
Quoted 8 lines · Andrew Morton
Quoted 2 lines · On Tue, 12 Feb 2008 10:32:31 +0100 Nadia Derbey <[email protected]> wrote:
it builds fine, modulo some changes in ipv4 and ipv6 (see attached patch
- didn't find it in the hot fixes).Quoted 11 lines
OK, thanks for checking. Did you confirm that we don't have unneeded code in vmlinux when
CONFIG_PROCFS=n? I guess before-and-after comparison of the size(1) output would tell us.Those networking build problems appear to have already been fixed.
In future, please quote the compiler error output in the changelog when sending build fixes or warning fixes, thanks.
BEFORE:
lkernel@akt$ size vmlinux text data bss dec hex filename 4318525 454484 462848 5235857 4fe491 vmlinuxAFTER:
lkernel@akt$ size vmlinux text data bss dec hex filename 4323161 454484 462848 5240493 4ff6ad vmlinuxwhich makes it +4636 = +0.11%
Quoted 10 lines
Quoted 2 lines
I've got the details for
*/built-in.oif needed.That seems to be a lot of increase. Are you sure you had
CONFIG_PROCFS=nin both cases? If so, the patch must have added a lot of code which will never be executed?
Well, the patches that are impacted by procfs being configured or not are #7 and #8. While the sizes I've sent you are before all patches applied vs after all patches applied :-(
So here are the "interesting sizes" - all with CONFIG_PROC_FS unset:
before patch 7:
text data bss dec hex filename
4318757 454484 462848 5236089 4fe579 vmlinux
before patch 8:
text data bss dec hex filename
4318853 454484 462848 5236185 4fe5d9 vmlinux +96
after patch 8:
4319055 454484 462848 5236387 4fe6a3 vmlinux +202
The higher difference after patch 8 is because I'm adding the new interface blocking_notifier_chain_cond_register() even if CONFIG_PROC_FS is not defined. This is to cover the case where msgmni is set through the sysctl() syscall (CONFIG_SYSCTL_SYSCALL).
Regards,
Nadia
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
A message that is not in the archive (sent off-list or not yet received): 20080212114439.e08085f1.akpm-de/[email protected]
Re: [PATCH 7/8] Do not recompute msgmni anymore if explicitely set by user
Quoted 41 lines · Andrew Morton
Quoted 37 lines · On Tue, 12 Feb 2008 16:15:00 +0100 Nadia Derbey…
Quoted 8 lines · Andrew Morton
Quoted 2 lines · On Tue, 12 Feb 2008 10:32:31 +0100 Nadia Derbey…
it builds fine, modulo some changes in ipv4 and ipv6 (see attached patch
- didn't find it in the hot fixes).Quoted 11 lines
OK, thanks for checking. Did you confirm that we don't have unneeded code in vmlinux when
CONFIG_PROCFS=n? I guess before-and-after comparison of the size(1) output would tell us.Those networking build problems appear to have already been fixed.
In future, please quote the compiler error output in the changelog when sending build fixes or warning fixes, thanks.
BEFORE:
lkernel@akt$ size vmlinux text data bss dec hex filename 4318525 454484 462848 5235857 4fe491 vmlinuxAFTER:
lkernel@akt$ size vmlinux text data bss dec hex filename 4323161 454484 462848 5240493 4ff6ad vmlinuxwhich makes it +4636 = +0.11%
Quoted 10 lines
Quoted 2 lines
I've got the details for
*/built-in.oif needed.That seems to be a lot of increase. Are you sure you had
CONFIG_PROCFS=nin both cases? If so, the patch must have added a lot of code which will never be executed?
Well, the patches that are impacted by procfs being configured or not are #7 and #8. While the sizes I've sent you are before all patches applied vs after all patches applied :-(
So here are the "interesting sizes" - all with CONFIG_PROC_FS unset:
before patch 7:
text data bss dec hex filename
4318757 454484 462848 5236089 4fe579 vmlinux
before patch 8:
text data bss dec hex filename
4318853 454484 462848 5236185 4fe5d9 vmlinux +96
after patch 8:
4319055 454484 462848 5236387 4fe6a3 vmlinux +202
The higher difference after patch 8 is because I'm adding the new interface blocking_notifier_chain_cond_register() even if CONFIG_PROC_FS is not defined. This is to cover the case where msgmni is set through the sysctl() syscall (CONFIG_SYSCTL_SYSCALL).
Regards,
Nadia
A message that is not in the archive (sent off-list or not yet received): 20080212014444.8bc3791b.akpm-de/[email protected]
Re: [PATCH 7/8] Do not recompute msgmni anymore if explicitely set by user
Quoted 7 lines · Andrew Morton
Quoted 2 lines · On Tue, 12 Feb 2008 10:32:31 +0100 Nadia Derbey…
it builds fine, modulo some changes in ipv4 and ipv6 (see attached patch
- didn't find it in the hot fixes).
Quoted 11 lines
OK, thanks for checking. Did you confirm that we don't have unneeded code in vmlinux when
CONFIG_PROCFS=n? I guess before-and-after comparison of the size(1) output would tell us.Those networking build problems appear to have already been fixed.
In future, please quote the compiler error output in the changelog when sending build fixes or warning fixes, thanks.
BEFORE:
lkernel@akt$ size vmlinux text data bss dec hex filename 4318525 454484 462848 5235857 4fe491 vmlinux
AFTER:
lkernel@akt$ size vmlinux text data bss dec hex filename 4323161 454484 462848 5240493 4ff6ad vmlinux
which makes it +4636 = +0.11%
I've got the details for */built-in.o if needed.
Regards,
Nadia
Re: [PATCH 7/8] Do not recompute msgmni anymore if explicitely set by user
In reply to Nadia DerbeyQuoted 56 lines · Nadia Derbey
Quoted 41 lines · Andrew Morton
Quoted 8 lines · On Mon, 11 Feb 2008 15:16:53 +0100 Nadia.Derbey-6ktuUTfB/[email protected]…
[PATCH 07/08]
This patch makes msgmni not recomputed anymore upon ipc namespace creation / removal or memory add/remove, as soon as it has been set from userland.
As soon as msgmni is explicitely set via procfs or
sysctl(), the associated callback routine is unregistered from the ipc namespace notifier chain.The patch series looks pretty good.
Quoted 24 lines
===================================================================
---linux-2.6.24-mm1.orig/ipc/ipc_sysctl.c2008-02-08
16:07:15.000000000 +0100
+++linux-2.6.24-mm1/ipc/ipc_sysctl.c2008-02-08
16:08:32.000000000 +0100(quoted diff) +15
-0@@ -35,6 +35,24 @@ static int proc_ipc_dointvec(ctl_table * return proc_dointvec(&ipc_table, write, filp, buffer, lenp, ppos); } +static int proc_ipc_callback_dointvec(ctl_table *table, int write, + struct file *filp, void __user *buffer, size_t *lenp, loff_t *ppos) +{ + size_t lenp_bef = *lenp; + int rc; + + rc = proc_ipc_dointvec(table, write, filp, buffer, lenp, ppos); + + if (write && !rc && lenp_bef == *lenp) + /* + * Tunable has successfully been changed from userland: + * disable its automatic recomputing. + */ + unregister_ipcns_notifier(current->nsproxy->ipc_ns); +Quoted 12 lines
Review static int proc_ipc_dointvec(ctl_table * · line 54
Quoted 2 lines
(quoted diff) +2
-0+ return rc; +}If you haven't done so, could you please check that it all builds cleanly with
CONFIG_PROCFS=n, and that all code which isn't needed if procfs is disabled is not present in the final binary?
Quoted 9 lines
Andrew,
it builds fine, modulo some changes in ipv4 and ipv6 (see attached patch
- didn't find it in the hot fixes).Regards,
Nadia
Oops, forgot the patch. Thx Benjamin!
_______________________________________________
Containers mailing list Containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
https://lists.linux-foundation.org/mailman/listinfo/containers
A message that is not in the archive (sent off-list or not yet received): 20080211122408.5008902f.akpm-de/[email protected]
Re: [PATCH 7/8] Do not recompute msgmni anymore if explicitely set by user
Quoted 38 lines · Andrew Morton
Quoted 8 lines · On Mon, 11 Feb 2008 15:16:53 +0100 Nadia.Derbey-6ktuUTfB/[email protected]…
[PATCH 07/08]
This patch makes msgmni not recomputed anymore upon ipc namespace creation / removal or memory add/remove, as soon as it has been set from userland.
As soon as msgmni is explicitely set via procfs or
sysctl(), the associated callback routine is unregistered from the ipc namespace notifier chain.The patch series looks pretty good.
Quoted 21 lines
===================================================================
ipc/ipc_sysctl.c +14
-0@@ -35,6 +35,24 @@ static int proc_ipc_dointvec(ctl_table *return proc_dointvec (&ipc_table, write, filp, buffer, lenp, ppos); } +static int proc_ipc_callback_dointvec (ctl_table *table,int write, +struct file *filp,void __user *buffer,size_t *lenp,loff_t *ppos) +{ +size_t lenp_bef = *lenp; +int rc; + + rc =proc_ipc_dointvec (table, write, filp, buffer, lenp, ppos); + +if (write && !rc && lenp_bef == *lenp) +/* +* Tunable has successfully been changed from userland: +* disable its automatic recomputing. +*/ +unregister_ipcns_notifier (current->nsproxy->ipc_ns);
Quoted 12 lines
ipc/ipc_sysctl.c static int proc_ipc_dointvec(ctl_table * · line 54
Quoted 3 lines
ipc/ipc_sysctl.c +3
-0+ +return rc; +}If you haven't done so, could you please check that it all builds cleanly with
CONFIG_PROCFS=n, and that all code which isn't needed if procfs is disabled is not present in the final binary?
Andrew,
it builds fine, modulo some changes in ipv4 and ipv6 (see attached patch - didn't find it in the hot fixes).
Regards,
Nadia
_______________________________________________
Containers mailing list Containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
https://lists.linux-foundation.org/mailman/listinfo/containers
A message that is not in the archive (sent off-list or not yet received): 20080211141816.094061000-6ktuUTfB/[email protected]
Re: [PATCH 7/8] Do not recompute msgmni anymore if explicitely set by user
Quoted 8 lines · On Mon, 11 Feb 2008 15:16:53 +0100 Nadia.Derbey-6ktuUTfB/[email protected]…
[PATCH 07/08]
This patch makes msgmni not recomputed anymore upon ipc namespace creation / removal or memory add/remove, as soon as it has been set from userland.
As soon as msgmni is explicitely set via procfs or
sysctl(), the associated callback routine is unregistered from the ipc namespace notifier chain.
The patch series looks pretty good.
Quoted 14 lines
===================================================================
ipc/ipc_sysctl.c +7
-0@@ -35,6 +35,24 @@ static int proc_ipc_dointvec(ctl_table *return proc_dointvec (&ipc_table, write, filp, buffer, lenp, ppos); } +static int proc_ipc_callback_dointvec (ctl_table *table,int write, +struct file *filp,void __user *buffer,size_t *lenp,loff_t *ppos) +{ +size_t lenp_bef = *lenp; +int rc; + + rc =proc_ipc_dointvec (table, write, filp, buffer, lenp, ppos);
ipc/ipc_sysctl.c static int proc_ipc_dointvec(ctl_table * · line 54
Quoted 10 lines
ipc/ipc_sysctl.c +10
-0+ +if (write && !rc && lenp_bef == *lenp) +/* +* Tunable has successfully been changed from userland: +* disable its automatic recomputing. +*/ +unregister_ipcns_notifier (current->nsproxy->ipc_ns); + +return rc; +}
If you haven't done so, could you please check that it all builds cleanly with CONFIG_PROCFS=n, and that all code which isn't needed if procfs is disabled is not present in the final binary?
PATCH 7/8 Do not recompute msgmni anymore if explicitely set by user
In reply to [email protected][PATCH 07/08]
This patch makes msgmni not recomputed anymore upon ipc namespace creation / removal or memory add/remove, as soon as it has been set from userland.
As soon as msgmni is explicitely set via procfs or sysctl(), the associated callback routine is unregistered from the ipc namespace notifier chain.
--- ipc/ipc_sysctl.c | 43 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 41 insertions(+), 2 deletions(-)
ipc/ipc_sysctl.c +41 -2
@@ -35,6 +35,24 @@ static int proc_ipc_dointvec(ctl_table *return proc_dointvec (&ipc_table, write, filp, buffer, lenp, ppos); } +static int proc_ipc_callback_dointvec (ctl_table *table,int write, +struct file *filp,void __user *buffer,size_t *lenp,loff_t *ppos) +{ +size_t lenp_bef = *lenp; +int rc; + + rc =proc_ipc_dointvec (table, write, filp, buffer, lenp, ppos); + +if (write && !rc && lenp_bef == *lenp) +/* +* Tunable has successfully been changed from userland: +* disable its automatic recomputing. +*/ +unregister_ipcns_notifier (current->nsproxy->ipc_ns); + +return rc; +} +static int proc_ipc_doulongvec_minmax (ctl_table *table,int write,struct file *filp,void __user *buffer,size_t *lenp,loff_t *ppos) {
@@ -49,6 +67,7 @@ static int proc_ipc_doulongvec_minmax(ct#else #define proc_ipc_doulongvec_minmax NULL#define proc_ipc_dointvec NULL +#define proc_ipc_callback_dointvec NULL#endif #ifdef CONFIG_SYSCTL_SYSCALL
@@ -90,8 +109,28 @@ static int sysctl_ipc_data(ctl_table *ta }return 1 ; } + +static int sysctl_ipc_registered_data (ctl_table *table,int __user *name, +int nlen,void __user *oldval,size_t __user *oldlenp, +void __user *newval,size_t newlen) +{ +int rc; + + rc =sysctl_ipc_data (table, name, nlen, oldval, oldlenp, newval, + newlen); + +if (newval && newlen && rc >0 ) +/* +* Tunable has successfully been changed from userland: +* disable its automatic recomputing. +*/ +unregister_ipcns_notifier (current->nsproxy->ipc_ns); + +return rc; +}#else #define sysctl_ipc_data NULL +#define sysctl_ipc_registered_data NULL#endif static struct ctl_table ipc_kern_table[] = {
@@ -137,8 +176,8 @@ static struct ctl_table ipc_kern_table[] .data = &init_ipc_ns.msg_ctlmni, .maxlen = sizeof (init_ipc_ns.msg_ctlmni), .mode = 0644, - .proc_handler = proc_ipc_dointvec, - .strategy = sysctl_ipc_data, + .proc_handler = proc_ipc_callback_dointvec, + .strategy = sysctl_ipc_registered_data, }, { .ctl_name = KERN_MSGMNB,
--
PATCH 8/8 Re-enable msgmni automatic recomputing msgmni if set to negative
In reply to [email protected][PATCH 08/08]
This patch is the enhancement as asked for by Yasunori: if msgmni is set to a negative value, register it back into the ipcns notifier chain.
A new interface has been added to the notification mechanism:notifier_chain_cond_register() registers a notifier block only if not already registered. With that new interface we avoid taking care of the states changes in procfs.
--- include/linux/ipc_namespace.h | 1 include/linux/notifier.h | 4 +++ ipc/ipc_sysctl.c | 45 ++++++++++++++++++++++++++++++++---------- ipc/ipcns_notifier.c | 9 ++++++++ kernel/notifier.c | 38 +++++++++++++++++++++++++++++++++++ 5 files changed, 87 insertions(+), 10 deletions(-)
ipc/ipc_sysctl.c +35 -10
@@ -15,6 +15,8 @@#include <linux/sysctl.h> #include <linux/uaccess.h> #include <linux/ipc_namespace.h> +#include <linux/msg.h> +#include "util.h" static void *get_ipc (ctl_table *table) {
@@ -24,6 +26,27 @@ static void *get_ipc(ctl_table *table)return which; } +/* +* Routine that is called when a tunable has successfully been changed by +* hand and it has a callback routine registered on the ipc namespace notifier +* chain: we don't want such tunables to be recomputed anymore upon memory +* add/remove or ipc namespace creation/removal. +* They can come back to a recomputable state by being set to a <0 value. +*/ +static void tunable_set_callback (int val) +{ +if (val >=0 ) +unregister_ipcns_notifier (current->nsproxy->ipc_ns); +else { +/* +* Re-enable automatic recomputing only if not already +* enabled. +*/ +recompute_msgmni (current->nsproxy->ipc_ns); +cond_register_ipcns_notifier (current->nsproxy->ipc_ns); + } +} +#ifdef CONFIG_PROC_FS static int proc_ipc_dointvec (ctl_table *table,int write,struct file *filp,void __user *buffer,size_t *lenp,loff_t *ppos)
@@ -38,17 +61,17 @@ static int proc_ipc_dointvec(ctl_table *static int proc_ipc_callback_dointvec (ctl_table *table,int write,struct file *filp,void __user *buffer,size_t *lenp,loff_t *ppos) { +struct ctl_table ipc_table;size_t lenp_bef = *lenp;int rc; - rc =proc_ipc_dointvec (table, write, filp, buffer, lenp, ppos); +memcpy (&ipc_table, table,sizeof (ipc_table)); + ipc_table.data =get_ipc (table); + + rc =proc_dointvec (&ipc_table, write, filp, buffer, lenp, ppos);if (write && !rc && lenp_bef == *lenp) -/* -* Tunable has successfully been changed from userland: -* disable its automatic recomputing. -*/ -unregister_ipcns_notifier (current->nsproxy->ipc_ns); +tunable_set_callback (*((int *)(ipc_table.data)));return rc; }
@@ -119,12 +142,14 @@ static int sysctl_ipc_registered_data(ct rc =sysctl_ipc_data (table, name, nlen, oldval, oldlenp, newval, newlen); -if (newval && newlen && rc >0 ) +if (newval && newlen && rc >0 ) {/* -* Tunable has successfully been changed from userland: -* disable its automatic recomputing. +* Tunable has successfully been changed from userland */ -unregister_ipcns_notifier (current->nsproxy->ipc_ns); +int *data =get_ipc (table); + +tunable_set_callback (*data); + }return rc; }
kernel/notifier.c +38 -0
@@ -31,6 +31,21 @@ static int notifier_chain_register(strucreturn 0 ; } +static int notifier_chain_cond_register (struct notifier_block **nl, +struct notifier_block *n) +{ +while ((*nl) !=NULL ) { +if ((*nl) == n) +return 0 ; +if (n->priority > (*nl)->priority) +break ; + nl = &((*nl)->next); + } + n->next = *nl; +rcu_assign_pointer (*nl, n); +return 0 ; +} +static int notifier_chain_unregister (struct notifier_block **nl,struct notifier_block *n) {
@@ -205,6 +220,29 @@ int blocking_notifier_chain_register(strEXPORT_SYMBOL_GPL (blocking_notifier_chain_register);/** +* blocking_notifier_chain_cond_register - Cond add notifier to a blocking notifier chain +* @nh: Pointer to head of the blocking notifier chain +* @n: New entry in notifier chain +* +* Adds a notifier to a blocking notifier chain, only if not already +* present in the chain. +* Must be called in process context. +* +* Currently always returns zero. +*/ +int blocking_notifier_chain_cond_register (struct blocking_notifier_head *nh, +struct notifier_block *n) +{ +int ret; + +down_write (&nh->rwsem); + ret =notifier_chain_cond_register (&nh->head, n); +up_write (&nh->rwsem); +return ret; +} +EXPORT_SYMBOL_GPL (blocking_notifier_chain_cond_register); + +/** * blocking_notifier_chain_unregister - Remove notifier from a blocking notifier chain * @nh: Pointer to head of the blocking notifier chain * @n: Entry to remove from notifier chain
include/linux/notifier.h +4 -0
@@ -121,6 +121,10 @@ extern int raw_notifier_chain_register(sextern int srcu_notifier_chain_register (struct srcu_notifier_head *nh,struct notifier_block *nb); +extern int blocking_notifier_chain_cond_register ( +struct blocking_notifier_head *nh, +struct notifier_block *nb); +extern int atomic_notifier_chain_unregister (struct atomic_notifier_head *nh,struct notifier_block *nb); extern int blocking_notifier_chain_unregister(struct blocking_notifier_head *nh,
include/linux/ipc_namespace.h +1 -0
@@ -52,6 +52,7 @@ extern atomic_t nr_ipc_ns;#define INIT_IPC_NS (ns) .ns = &init_ipc_ns,extern int register_ipcns_notifier (struct ipc_namespace *); +extern int cond_register_ipcns_notifier (struct ipc_namespace *);extern int unregister_ipcns_notifier (struct ipc_namespace *);extern int ipcns_notify (unsigned long );
ipc/ipcns_notifier.c +9 -0
@@ -61,6 +61,15 @@ int register_ipcns_notifier(struct ipc_nreturn blocking_notifier_chain_register (&ipcns_chain, &ns->ipcns_nb); } +int cond_register_ipcns_notifier (struct ipc_namespace *ns) +{ +memset (&ns->ipcns_nb,0 ,sizeof (ns->ipcns_nb)); + ns->ipcns_nb.notifier_call = ipcns_callback; + ns->ipcns_nb.priority =IPCNS_CALLBACK_PRI ; +return blocking_notifier_chain_cond_register (&ipcns_chain, + &ns->ipcns_nb); +} +int unregister_ipcns_notifier (struct ipc_namespace *ns) { return blocking_notifier_chain_unregister(&ipcns_chain,
--
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Andrew Morton
maintainerRe: [PATCH 8/8] Re-enable msgmni automatic recomputing msgmni if set to negative
Quoted 44 lines · On Mon, 11 Feb 2008 15:16:54 +0100 [email protected] wrote:
[PATCH 08/08]
This patch is the enhancement as asked for by Yasunori: if msgmni is set to a negative value, register it back into the ipcns notifier chain.
A new interface has been added to the notification mechanism:
notifier_chain_cond_register()registers a notifier block only if not already registered. With that new interface we avoid taking care of the states changes in procfs....
static int proc_ipc_callback_dointvec(ctl_table *table, int write,
ipc/ipc_sysctl.c +7
-9struct file *filp, void __user *buffer, size_t *lenp, loff_t *ppos) { + struct ctl_table ipc_table;size_t lenp_bef = *lenp;int rc; - rc =proc_ipc_dointvec (table, write, filp, buffer, lenp, ppos); +memcpy (&ipc_table, table,sizeof (ipc_table)); + ipc_table.data =get_ipc (table); + + rc =proc_dointvec (&ipc_table, write, filp, buffer, lenp, ppos);if (write && !rc && lenp_bef == *lenp) -/* -* Tunable has successfully been changed from userland: -* disable its automatic recomputing. -*/ -unregister_ipcns_notifier (current->nsproxy->ipc_ns); +tunable_set_callback (*((int *)(ipc_table.data)));return rc; }@@ -119,12 +142,14 @@ static int sysctl_ipc_registered_data(ct rc =sysctl_ipc_data (table, name, nlen, oldval, oldlenp, newval, newlen); -if (newval && newlen && rc >0 ) +if (newval && newlen && rc >0 ) {/* -* Tunable has successfully been changed from userland: -* disable its automatic recomputing.
ipc/ipc_sysctl.c static int sysctl_ipc_registered_data(ct · line 155
Quoted 10 lines
ipc/ipc_sysctl.c +5
-1+* Tunable has successfully been changed from userland */ -unregister_ipcns_notifier (current->nsproxy->ipc_ns); +int *data =get_ipc (table); + +tunable_set_callback (*data); + }return rc; }
hm, what's happening here? We take a local copy of the caller's ctl_table and then pass that into proc_dointvec(). Is that as hacky as it seems??
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH 8/8] Re-enable msgmni automatic recomputing msgmni if set to negative
Quoted 56 lines · Andrew Morton
Quoted 52 lines · On Mon, 11 Feb 2008 15:16:54 +0100 [email protected] wrote:
[PATCH 08/08]
This patch is the enhancement as asked for by Yasunori: if msgmni is set to a negative value, register it back into the ipcns notifier chain.
A new interface has been added to the notification mechanism:
notifier_chain_cond_register()registers a notifier block only if not already registered. With that new interface we avoid taking care of the states changes in procfs....
static int proc_ipc_callback_dointvec(ctl_table *table, int write,
struct file *filp, void__user*buffer,size_t*lenp,loff_t*ppos)
{ipc/ipc_sysctl.c +1
-0+struct ctl_table ipc_table;size_t lenp_bef = *lenp; int rc;ipc/ipc_sysctl.c +4
-1- rc =proc_ipc_dointvec (table, write, filp, buffer, lenp, ppos); +memcpy (&ipc_table, table,sizeof (ipc_table)); + ipc_table.data =get_ipc (table); + + rc =proc_dointvec (&ipc_table, write, filp, buffer, lenp, ppos);if (write && !rc && lenp_bef == *lenp)ipc/ipc_sysctl.c +1
-5-/* -* Tunable has successfully been changed from userland: -* disable its automatic recomputing. -*/ -unregister_ipcns_notifier (current->nsproxy->ipc_ns); +tunable_set_callback (*((int *)(ipc_table.data)));return rc; }ipc/ipc_sysctl.c +6
-4@@ -119,12 +142,14 @@ static int sysctl_ipc_registered_data(ct rc =sysctl_ipc_data (table, name, nlen, oldval, oldlenp, newval, newlen); -if (newval && newlen && rc >0 ) +if (newval && newlen && rc >0 ) {/* -* Tunable has successfully been changed from userland: -* disable its automatic recomputing. +* Tunable has successfully been changed from userland */ -unregister_ipcns_notifier (current->nsproxy->ipc_ns); +int *data =get_ipc (table); + +tunable_set_callback (*data); + }
Quoted 8 lines
Review static int sysctl_ipc_registered_data(ct · line 155
Quoted 2 lines
(quoted diff) +0
-0return rc; }hm, what's happening here? We take a local copy of the caller's
ctl_tableand then pass that intoproc_dointvec(). Is that as hacky as it seems??
Well, the caller's ctl_table contains the tunables addresses for the init namspeace in its .data fields. While what needs to be passed in to proc_dointvec() is the tunable address in the caller's namespace. Since all the fields in ipc_kern_table[] are ok but the .data one, imho it's correct to store it in a local copy and change the data field to the appropirate one, before passing it to proc_dointvec().
Regards,
Nadia
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
A message that is not in the archive (sent off-list or not yet received): 20080211122748.64e7bc36.akpm-de/[email protected]
Re: [PATCH 8/8] Re-enable msgmni automatic recomputing msgmni if set to negative
Quoted 56 lines · Andrew Morton
Quoted 52 lines · On Mon, 11 Feb 2008 15:16:54 +0100 Nadia.Derbey-6ktuUTfB/[email protected]…
[PATCH 08/08]
This patch is the enhancement as asked for by Yasunori: if msgmni is set to a negative value, register it back into the ipcns notifier chain.
A new interface has been added to the notification mechanism:
notifier_chain_cond_register()registers a notifier block only if not already registered. With that new interface we avoid taking care of the states changes in procfs....
static int proc_ipc_callback_dointvec(ctl_table *table, int write,
struct file *filp, void__user*buffer,size_t*lenp,loff_t*ppos)
{ipc/ipc_sysctl.c +1
-0+struct ctl_table ipc_table;size_t lenp_bef = *lenp; int rc;ipc/ipc_sysctl.c +4
-1- rc =proc_ipc_dointvec (table, write, filp, buffer, lenp, ppos); +memcpy (&ipc_table, table,sizeof (ipc_table)); + ipc_table.data =get_ipc (table); + + rc =proc_dointvec (&ipc_table, write, filp, buffer, lenp, ppos);if (write && !rc && lenp_bef == *lenp)ipc/ipc_sysctl.c +1
-5-/* -* Tunable has successfully been changed from userland: -* disable its automatic recomputing. -*/ -unregister_ipcns_notifier (current->nsproxy->ipc_ns); +tunable_set_callback (*((int *)(ipc_table.data)));return rc; }ipc/ipc_sysctl.c +6
-4@@ -119,12 +142,14 @@ static int sysctl_ipc_registered_data(ct rc =sysctl_ipc_data (table, name, nlen, oldval, oldlenp, newval, newlen); -if (newval && newlen && rc >0 ) +if (newval && newlen && rc >0 ) {/* -* Tunable has successfully been changed from userland: -* disable its automatic recomputing. +* Tunable has successfully been changed from userland */ -unregister_ipcns_notifier (current->nsproxy->ipc_ns); +int *data =get_ipc (table); + +tunable_set_callback (*data); + }
Quoted 8 lines
Review static int sysctl_ipc_registered_data(ct · line 155
Quoted 2 lines
(quoted diff) +0
-0return rc; }hm, what's happening here? We take a local copy of the caller's
ctl_tableand then pass that intoproc_dointvec(). Is that as hacky as it seems??
Well, the caller's ctl_table contains the tunables addresses for the init namspeace in its .data fields. While what needs to be passed in to proc_dointvec() is the tunable address in the caller's namespace. Since all the fields in ipc_kern_table[] are ok but the .data one, imho it's correct to store it in a local copy and change the data field to the appropirate one, before passing it to proc_dointvec().
Regards,
Nadia
A message that is not in the archive (sent off-list or not yet received): 20080211141816.520049000-6ktuUTfB/[email protected]
Re: [PATCH 8/8] Re-enable msgmni automatic recomputing msgmni if set to negative
Quoted 44 lines · On Mon, 11 Feb 2008 15:16:54 +0100 Nadia.Derbey-6ktuUTfB/[email protected]…
[PATCH 08/08]
This patch is the enhancement as asked for by Yasunori: if msgmni is set to a negative value, register it back into the ipcns notifier chain.
A new interface has been added to the notification mechanism:
notifier_chain_cond_register()registers a notifier block only if not already registered. With that new interface we avoid taking care of the states changes in procfs....
static int proc_ipc_callback_dointvec(ctl_table *table, int write,
ipc/ipc_sysctl.c +7
-9struct file *filp, void __user *buffer, size_t *lenp, loff_t *ppos) { + struct ctl_table ipc_table;size_t lenp_bef = *lenp;int rc; - rc =proc_ipc_dointvec (table, write, filp, buffer, lenp, ppos); +memcpy (&ipc_table, table,sizeof (ipc_table)); + ipc_table.data =get_ipc (table); + + rc =proc_dointvec (&ipc_table, write, filp, buffer, lenp, ppos);if (write && !rc && lenp_bef == *lenp) -/* -* Tunable has successfully been changed from userland: -* disable its automatic recomputing. -*/ -unregister_ipcns_notifier (current->nsproxy->ipc_ns); +tunable_set_callback (*((int *)(ipc_table.data)));return rc; }@@ -119,12 +142,14 @@ static int sysctl_ipc_registered_data(ct rc =sysctl_ipc_data (table, name, nlen, oldval, oldlenp, newval, newlen); -if (newval && newlen && rc >0 ) +if (newval && newlen && rc >0 ) {/* -* Tunable has successfully been changed from userland: -* disable its automatic recomputing.
ipc/ipc_sysctl.c static int sysctl_ipc_registered_data(ct · line 155
Quoted 10 lines
ipc/ipc_sysctl.c +5
-1+* Tunable has successfully been changed from userland */ -unregister_ipcns_notifier (current->nsproxy->ipc_ns); +int *data =get_ipc (table); + +tunable_set_callback (*data); + }return rc; }
hm, what's happening here? We take a local copy of the caller's ctl_table and then pass that into proc_dointvec(). Is that as hacky as it seems??
PATCH 8/8 Re-enable msgmni automatic recomputing msgmni if set to negative
In reply to [email protected][PATCH 08/08]
This patch is the enhancement as asked for by Yasunori: if msgmni is set to a negative value, register it back into the ipcns notifier chain.
A new interface has been added to the notification mechanism:notifier_chain_cond_register() registers a notifier block only if not already registered. With that new interface we avoid taking care of the states changes in procfs.
--- include/linux/ipc_namespace.h | 1 include/linux/notifier.h | 4 +++ ipc/ipc_sysctl.c | 45 ++++++++++++++++++++++++++++++++---------- ipc/ipcns_notifier.c | 9 ++++++++ kernel/notifier.c | 38 +++++++++++++++++++++++++++++++++++ 5 files changed, 87 insertions(+), 10 deletions(-)
ipc/ipc_sysctl.c +35 -10
@@ -15,6 +15,8 @@#include <linux/sysctl.h> #include <linux/uaccess.h> #include <linux/ipc_namespace.h> +#include <linux/msg.h> +#include "util.h" static void *get_ipc (ctl_table *table) {
@@ -24,6 +26,27 @@ static void *get_ipc(ctl_table *table)return which; } +/* +* Routine that is called when a tunable has successfully been changed by +* hand and it has a callback routine registered on the ipc namespace notifier +* chain: we don't want such tunables to be recomputed anymore upon memory +* add/remove or ipc namespace creation/removal. +* They can come back to a recomputable state by being set to a <0 value. +*/ +static void tunable_set_callback (int val) +{ +if (val >=0 ) +unregister_ipcns_notifier (current->nsproxy->ipc_ns); +else { +/* +* Re-enable automatic recomputing only if not already +* enabled. +*/ +recompute_msgmni (current->nsproxy->ipc_ns); +cond_register_ipcns_notifier (current->nsproxy->ipc_ns); + } +} +#ifdef CONFIG_PROC_FS static int proc_ipc_dointvec (ctl_table *table,int write,struct file *filp,void __user *buffer,size_t *lenp,loff_t *ppos)
@@ -38,17 +61,17 @@ static int proc_ipc_dointvec(ctl_table *static int proc_ipc_callback_dointvec (ctl_table *table,int write,struct file *filp,void __user *buffer,size_t *lenp,loff_t *ppos) { +struct ctl_table ipc_table;size_t lenp_bef = *lenp;int rc; - rc =proc_ipc_dointvec (table, write, filp, buffer, lenp, ppos); +memcpy (&ipc_table, table,sizeof (ipc_table)); + ipc_table.data =get_ipc (table); + + rc =proc_dointvec (&ipc_table, write, filp, buffer, lenp, ppos);if (write && !rc && lenp_bef == *lenp) -/* -* Tunable has successfully been changed from userland: -* disable its automatic recomputing. -*/ -unregister_ipcns_notifier (current->nsproxy->ipc_ns); +tunable_set_callback (*((int *)(ipc_table.data)));return rc; }
@@ -119,12 +142,14 @@ static int sysctl_ipc_registered_data(ct rc =sysctl_ipc_data (table, name, nlen, oldval, oldlenp, newval, newlen); -if (newval && newlen && rc >0 ) +if (newval && newlen && rc >0 ) {/* -* Tunable has successfully been changed from userland: -* disable its automatic recomputing. +* Tunable has successfully been changed from userland */ -unregister_ipcns_notifier (current->nsproxy->ipc_ns); +int *data =get_ipc (table); + +tunable_set_callback (*data); + }return rc; }
kernel/notifier.c +38 -0
@@ -31,6 +31,21 @@ static int notifier_chain_register(strucreturn 0 ; } +static int notifier_chain_cond_register (struct notifier_block **nl, +struct notifier_block *n) +{ +while ((*nl) !=NULL ) { +if ((*nl) == n) +return 0 ; +if (n->priority > (*nl)->priority) +break ; + nl = &((*nl)->next); + } + n->next = *nl; +rcu_assign_pointer (*nl, n); +return 0 ; +} +static int notifier_chain_unregister (struct notifier_block **nl,struct notifier_block *n) {
@@ -205,6 +220,29 @@ int blocking_notifier_chain_register(strEXPORT_SYMBOL_GPL (blocking_notifier_chain_register);/** +* blocking_notifier_chain_cond_register - Cond add notifier to a blocking notifier chain +* @nh: Pointer to head of the blocking notifier chain +* @n: New entry in notifier chain +* +* Adds a notifier to a blocking notifier chain, only if not already +* present in the chain. +* Must be called in process context. +* +* Currently always returns zero. +*/ +int blocking_notifier_chain_cond_register (struct blocking_notifier_head *nh, +struct notifier_block *n) +{ +int ret; + +down_write (&nh->rwsem); + ret =notifier_chain_cond_register (&nh->head, n); +up_write (&nh->rwsem); +return ret; +} +EXPORT_SYMBOL_GPL (blocking_notifier_chain_cond_register); + +/** * blocking_notifier_chain_unregister - Remove notifier from a blocking notifier chain * @nh: Pointer to head of the blocking notifier chain * @n: Entry to remove from notifier chain
include/linux/notifier.h +4 -0
@@ -121,6 +121,10 @@ extern int raw_notifier_chain_register(sextern int srcu_notifier_chain_register (struct srcu_notifier_head *nh,struct notifier_block *nb); +extern int blocking_notifier_chain_cond_register ( +struct blocking_notifier_head *nh, +struct notifier_block *nb); +extern int atomic_notifier_chain_unregister (struct atomic_notifier_head *nh,struct notifier_block *nb); extern int blocking_notifier_chain_unregister(struct blocking_notifier_head *nh,
include/linux/ipc_namespace.h +1 -0
@@ -52,6 +52,7 @@ extern atomic_t nr_ipc_ns;#define INIT_IPC_NS (ns) .ns = &init_ipc_ns,extern int register_ipcns_notifier (struct ipc_namespace *); +extern int cond_register_ipcns_notifier (struct ipc_namespace *);extern int unregister_ipcns_notifier (struct ipc_namespace *);extern int ipcns_notify (unsigned long );
ipc/ipcns_notifier.c +9 -0
@@ -61,6 +61,15 @@ int register_ipcns_notifier(struct ipc_nreturn blocking_notifier_chain_register (&ipcns_chain, &ns->ipcns_nb); } +int cond_register_ipcns_notifier (struct ipc_namespace *ns) +{ +memset (&ns->ipcns_nb,0 ,sizeof (ns->ipcns_nb)); + ns->ipcns_nb.notifier_call = ipcns_callback; + ns->ipcns_nb.priority =IPCNS_CALLBACK_PRI ; +return blocking_notifier_chain_cond_register (&ipcns_chain, + &ns->ipcns_nb); +} +int unregister_ipcns_notifier (struct ipc_namespace *ns) { return blocking_notifier_chain_unregister(&ipcns_chain,
--