Discussion:
[PATCH] udev: Lower the starting children_max -> drop the minimum required RAM from 23mb to 5mb
Lauri Kasanen
2012-06-03 15:28:08 UTC
Permalink
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 <***@operamail.com>
---
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
Kay Sievers
2012-06-04 14:38:26 UTC
Permalink
Post by Lauri Kasanen
Udev was the limiting factor for us on low-RAM systems.
Given an average RSS of 180kb, 128 workers would require ~23mb of RAM.
All workers are direct clone()s of the master process without exec(),
you are sure that every of them uses additional 128k?
Post by Lauri Kasanen
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.
It does, if does not get started by systemd.
Post by Lauri Kasanen
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.
That logic is from the time we needed to fork() for every event. Even
on a system with lots of devices we usually do not need more than
30-50 workers. Today, workers are re-used; we could lower that limit
even more if needed, without bad side effects.

Applied.

Thanks,
Kay
--
To unsubscribe from this list: send the line "unsubscribe linux-hotplug" in
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Lauri Kasanen
2012-06-04 16:21:52 UTC
Permalink
Hi
Post by Kay Sievers
All workers are direct clone()s of the master process without exec(),
you are sure that every of them uses additional 128k?
I'm not sure whether it was every worker, but without that commit our
system required 43mb to boot.
With that commit we could boot with only 30mb.
Post by Kay Sievers
It does, if does not get started by systemd.
Yep, not using systemd.

Thanks,
- Lauri
--
http://www.fastmail.fm - Access all of your messages and folders
wherever you are

--
To unsubscribe from this list: send the line "unsubscribe linux-hotplug" in
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Loading...