[PATCH] udev: Lower the starting children_max -> drop the minimum required RAM from 23mb to 5mb

Lauri Kasanen <[email protected]>
Newsgroups gmane.linux.hotplug.devel
Message-ID <1338737288.24120.140661084367789.5D16C15D@webmail.messagingengine.com>
Hi all

Udev was the limiting factor for us on low-RAM systems.
Given an average RSS of 180kb, 128 workers would require ~23mb of RAM.

Now, please consider what happens when there is only, say, 15mb free.
Udev protects itself from OOM, and the kernel can do nothing but panic.

28 workers * 0.18mb = ~5mb. This change should not affect more powerful
systems much, given that they still get the addition from the amount of RAM.

PS: Please CC me.

Signed-off-by: Lauri Kasanen <[email protected]>
---
 src/udev/udevd.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/udev/udevd.c b/src/udev/udevd.c
index 7905310..229031c 100644
--- a/src/udev/udevd.c
+++ b/src/udev/udevd.c
@@ -1353,9 +1353,9 @@ int main(int argc, char *argv[])
 
                 /* set value depending on the amount of RAM */
                 if (memsize > 0)
-                        children_max = 128 + (memsize / 8);
+                        children_max = 28 + (memsize / 8);
                 else
-                        children_max = 128;
+                        children_max = 28;
         }
         log_debug("set children_max to %u\n", children_max);
 
-- 
1.7.2.1

-- 
http://www.fastmail.fm - The professional email service
0001-udev-Lower-the-starting-children_max-drop-the-minimu.patch (text/x-diff, 1.4 KB)
From f08a54bd6b39d448702d8dcbc59910fea419c456 Mon Sep 17 00:00:00 2001
From: Lauri Kasanen <[email protected]>
Date: Sun, 3 Jun 2012 18:11:58 +0300
Subject: [PATCH] udev: Lower the starting children_max -> drop the minimum required RAM from 23mb to 5mb

Udev was the limiting factor for us on low-RAM systems.
Given an average RSS of 180kb, 128 workers would require ~23mb of RAM.

Now, please consider what happens when there is only, say, 15mb free.
Udev protects itself from OOM, and the kernel can do nothing but panic.

28 workers * 0.18mb = ~5mb. This change should not affect more powerful
systems much, given that they still get the addition from the amount of RAM.

Signed-off-by: Lauri Kasanen <[email protected]>
---
 src/udev/udevd.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/udev/udevd.c b/src/udev/udevd.c
index 7905310..229031c 100644
--- a/src/udev/udevd.c
+++ b/src/udev/udevd.c
@@ -1353,9 +1353,9 @@ int main(int argc, char *argv[])
 
                 /* set value depending on the amount of RAM */
                 if (memsize > 0)
-                        children_max = 128 + (memsize / 8);
+                        children_max = 28 + (memsize / 8);
                 else
-                        children_max = 128;
+                        children_max = 28;
         }
         log_debug("set children_max to %u\n", children_max);
 
-- 
1.7.2.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.