linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/8] Change default MSGMNI tunable to scale with lowmem (v3)
@ 2008-02-11 14:16 Nadia.Derbey
  2008-02-11 14:16 ` [PATCH 1/8] Scaling msgmni to the amount of lowmem Nadia.Derbey
                   ` (7 more replies)
  0 siblings, 8 replies; 43+ messages in thread
From: Nadia.Derbey @ 2008-02-11 14:16 UTC (permalink / raw)
  To: linux-kernel, y-goto, akpm; +Cc: linux-mm, containers, matthltc, cmm


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

--

^ permalink raw reply	[flat|nested] 43+ messages in thread
* Re: [PATCH 1/8] Scaling msgmni to the amount of lowmem
@ 2008-05-20 14:28 Michael Kerrisk
  2008-05-20 14:45 ` Nadia Derbey
  0 siblings, 1 reply; 43+ messages in thread
From: Michael Kerrisk @ 2008-05-20 14:28 UTC (permalink / raw)
  To: Nadia.Derbey; +Cc: Linux Kernel Mailing List, linux-mm

Hello Nadia,

Regarding your:

[PATCH 1/8] Scaling msgmni to the amount of lowmem
http://article.gmane.org/gmane.linux.kernel/637849/
which I see has made its way in 2.6.26-rc

Your patch has the following change:

-#define MSGPOOL (MSGMNI*MSGMNB/1024)  /* size in kilobytes of message pool */
+#define MSGPOOL (MSGMNI * MSGMNB) /* size in bytes of message pool */

Since this constitutes a kernel-userland interface change, so please
do CC me, so that I can change the man pages if needed.

The man page (http://www.kernel.org/doc/man-pages/online/pages/man2/msgctl.2.html)
does indeed say that msgpool is "unused".  But that meant "unused by
the kernel" (sorry -- I probably should have worded that text better).
 And, as you spotted, the page also wrongly said the value is in
bytes.

However, making this change affects the ABI.  A userspace application
that was previously using msgctl(IPC_INFO) to retrieve the msgpool
field will be affected by the factor-of-1024 change.  I strongly
suspect that there no such applications, or certainly none that care
(since this value is unused by the kernel).  But was there a reason
for making this change, aside from the fact that the code and the man
page didn't agree?

Cheers,

Michael

-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Found a bug? http://www.kernel.org/doc/man-pages/reporting_bugs.html

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

end of thread, other threads:[~2008-05-21 10:47 UTC | newest]

Thread overview: 43+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-11 14:16 [PATCH 0/8] Change default MSGMNI tunable to scale with lowmem (v3) Nadia.Derbey
2008-02-11 14:16 ` [PATCH 1/8] Scaling msgmni to the amount of lowmem Nadia.Derbey
2008-02-16  5:59   ` Andrew Morton
2008-02-18  9:19     ` Nadia Derbey
2008-02-18 13:08       ` Nadia Derbey
2008-02-19  8:50         ` [LTP] " Subrata Modak
2008-02-19 17:16           ` Nadia Derbey
2008-02-19 22:16             ` Matt Helsley
2008-02-21  8:39               ` Nadia Derbey
2008-02-21 12:36               ` Nadia Derbey
2008-02-21 13:02                 ` Nadia Derbey
2008-02-21 13:39                   ` Subrata Modak
2008-02-22  6:25                     ` Nadia Derbey
2008-02-22  8:41                       ` Subrata Modak
2008-02-20  9:44             ` Subrata Modak
2008-04-29 20:28   ` Tony Luck
2008-05-05  8:45     ` Nadia Derbey
2008-05-06 16:42       ` Luck, Tony
2008-05-06 18:05         ` Serge E. Hallyn
2008-05-07  5:37           ` Nadia Derbey
2008-05-07 13:17             ` Serge E. Hallyn
2008-05-07 18:12               ` Matt Helsley
2008-05-07  5:13         ` Nadia Derbey
2008-02-11 14:16 ` [PATCH 2/8] Scaling msgmni to the number of ipc namespaces Nadia.Derbey
2008-02-11 14:16 ` [PATCH 3/8] Defining the slab_memory_callback priority as a constant Nadia.Derbey
2008-02-11 14:16 ` [PATCH 4/8] Recomputing msgmni on memory add / remove Nadia.Derbey
2008-02-11 14:16 ` [PATCH 5/8] Invoke the ipcns notifier chain as a work item Nadia.Derbey
2008-02-11 14:16 ` [PATCH 6/8] Recomputing msgmni on ipc namespace creation/removal Nadia.Derbey
2008-02-11 14:16 ` [PATCH 7/8] Do not recompute msgmni anymore if explicitely set by user Nadia.Derbey
2008-02-11 20:24   ` Andrew Morton
2008-02-12  9:32     ` Nadia Derbey
2008-02-12  9:44       ` Andrew Morton
2008-02-12 15:15         ` Nadia Derbey
2008-02-12 19:44           ` Andrew Morton
2008-02-14 11:47             ` Nadia Derbey
2008-02-12  9:45       ` Nadia Derbey
2008-02-11 14:16 ` [PATCH 8/8] Re-enable msgmni automatic recomputing msgmni if set to negative Nadia.Derbey
2008-02-11 20:27   ` Andrew Morton
2008-02-12 11:38     ` Nadia Derbey
2008-05-20 14:28 [PATCH 1/8] Scaling msgmni to the amount of lowmem Michael Kerrisk
2008-05-20 14:45 ` Nadia Derbey
2008-05-20 14:56   ` Michael Kerrisk
2008-05-21 10:47   ` Michael Kerrisk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).