[systemd-commits] 5 commits - src/core src/udev TODO

Kay Sievers kay at kemper.freedesktop.org
Mon Jun 4 09:12:32 PDT 2012


 TODO                    |    1 +
 src/core/dbus-execute.c |    8 --------
 src/core/execute.c      |   19 +++----------------
 src/udev/udevd.c        |   14 ++++++--------
 4 files changed, 10 insertions(+), 32 deletions(-)

New commits:
commit 145dae7eb3367933e0d0bfcde3a7a77bb549aa61
Author: Kay Sievers <kay at vrfy.org>
Date:   Mon Jun 4 18:10:50 2012 +0200

    udev: reset /proc/self/oom_score_adj in worker processes
    
    Only the main daemon process should be excluded from OOM handling,
    not the worker processes or their child processes.

diff --git a/src/udev/udevd.c b/src/udev/udevd.c
index 8ad1ecc..2ac9fde 100644
--- a/src/udev/udevd.c
+++ b/src/udev/udevd.c
@@ -262,6 +262,9 @@ static void worker_new(struct event *event)
                 /* request TERM signal if parent exits */
                 prctl(PR_SET_PDEATHSIG, SIGTERM);
 
+                /* reset OOM score, we only protect the main daemon */
+                write_one_line_file("/proc/self/oom_score_adj", "0");
+
                 for (;;) {
                         struct udev_event *udev_event;
                         struct worker_message msg;
@@ -1230,7 +1233,6 @@ int main(int argc, char *argv[])
 
         if (daemonize) {
                 pid_t pid;
-                int fd;
 
                 pid = fork();
                 switch (pid) {
@@ -1247,11 +1249,7 @@ int main(int argc, char *argv[])
 
                 setsid();
 
-                fd = open("/proc/self/oom_score_adj", O_RDWR|O_CLOEXEC);
-                if (fd >= 0) {
-                        write(fd, "-1000", 5);
-                        close(fd);
-                }
+                write_one_line_file("/proc/self/oom_score_adj", "-1000");
         } else {
                 sd_notify(1, "READY=1");
         }

commit 8600c525cb1420570e7670c963abd19c5696b683
Author: Kay Sievers <kay at vrfy.org>
Date:   Mon Jun 4 16:41:10 2012 +0200

    remove support for deprecated /proc/self/oom_adj

diff --git a/src/core/dbus-execute.c b/src/core/dbus-execute.c
index f1a9da0..9322cdf 100644
--- a/src/core/dbus-execute.c
+++ b/src/core/dbus-execute.c
@@ -83,14 +83,6 @@ int bus_execute_append_oom_score_adjust(DBusMessageIter *i, const char *property
                 if (read_one_line_file("/proc/self/oom_score_adj", &t) >= 0) {
                         safe_atoi(t, &n);
                         free(t);
-                } else if (read_one_line_file("/proc/self/oom_adj", &t) >= 0) {
-                        safe_atoi(t, &n);
-                        free(t);
-
-                        if (n == OOM_ADJUST_MAX)
-                                n = OOM_SCORE_ADJ_MAX;
-                        else
-                                n = (n * OOM_SCORE_ADJ_MAX) / -OOM_DISABLE;
                 }
         }
 
diff --git a/src/core/execute.c b/src/core/execute.c
index 3ef4eaf..1b56f6b 100644
--- a/src/core/execute.c
+++ b/src/core/execute.c
@@ -1129,22 +1129,9 @@ int exec_spawn(ExecCommand *command,
                         char_array_0(t);
 
                         if (write_one_line_file("/proc/self/oom_score_adj", t) < 0) {
-                                /* Compatibility with Linux <= 2.6.35 */
-
-                                int adj;
-
-                                adj = (context->oom_score_adjust * -OOM_DISABLE) / OOM_SCORE_ADJ_MAX;
-                                adj = CLAMP(adj, OOM_DISABLE, OOM_ADJUST_MAX);
-
-                                snprintf(t, sizeof(t), "%i", adj);
-                                char_array_0(t);
-
-                                if (write_one_line_file("/proc/self/oom_adj", t) < 0
-                                    && errno != EACCES) {
-                                        err = -errno;
-                                        r = EXIT_OOM_ADJUST;
-                                        goto fail_child;
-                                }
+                                err = -errno;
+                                r = EXIT_OOM_ADJUST;
+                                goto fail_child;
                         }
                 }
 

commit d315bba6f6c9d929acdbf3c37cbcf6c9a72365ac
Author: Kay Sievers <kay at vrfy.org>
Date:   Mon Jun 4 16:40:31 2012 +0200

    udev: limit minimum worker count to 16

diff --git a/src/udev/udevd.c b/src/udev/udevd.c
index 229031c..8ad1ecc 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 = 28 + (memsize / 8);
+                        children_max = 16 + (memsize / 8);
                 else
-                        children_max = 28;
+                        children_max = 16;
         }
         log_debug("set children_max to %u\n", children_max);
 

commit 98cfcde5f49f6ca6560ecf4c24a455196dd6d0c1
Author: Kay Sievers <kay at vrfy.org>
Date:   Mon Jun 4 16:40:08 2012 +0200

    update TODO

diff --git a/TODO b/TODO
index 1d30869..1f7f974 100644
--- a/TODO
+++ b/TODO
@@ -26,6 +26,7 @@ Bugfixes:
    rename enum "ManagerRunningAs" to "SystemdRunningAs" and move it to shared/
 
 Features:
+* falconindy: allow unescaped pathes for mount units, like "systmectl status /.mount"?
 
 * handle C-A-Del in logind, like the power/suspend buttons?
 

commit a52289f7f50b3e851bf831cb692eea9ff02e9b50
Author: Lauri Kasanen <curaga at operamail.com>
Date:   Sun Jun 3 18:11:58 2012 +0300

    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.

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);
 



More information about the systemd-commits mailing list