diff options
author | Franck Bui <fbui@suse.com> | 2019-04-24 11:26:42 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2019-04-26 09:58:12 +0200 |
commit | 5406c36844b35504a64e9f05fc74b8e5e5a09143 (patch) | |
tree | f8b62e5255f38fbda7e5735a3c368bccfb7dc260 /src/udev | |
parent | a6d04b1a179643685cabda9e489b34f24c287f27 (diff) | |
download | systemd-5406c36844b35504a64e9f05fc74b8e5e5a09143.tar.gz |
udevd: notify when max number value of children is reached only once per batch of events
When booting with "udev.log-priority=debug" for example, the output might be
spammed with messages like this:
systemd-udevd[23545]: maximum number (248) of children reached
systemd-udevd[23545]: maximum number (248) of children reached
systemd-udevd[23545]: maximum number (248) of children reached
systemd-udevd[23545]: maximum number (248) of children reached
systemd-udevd[23545]: maximum number (248) of children reached
systemd-udevd[23545]: maximum number (248) of children reached
systemd-udevd[23545]: maximum number (248) of children reached
While the message itself is useful, printing it per batch of events should be
enough.
Diffstat (limited to 'src/udev')
-rw-r--r-- | src/udev/udevd.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/udev/udevd.c b/src/udev/udevd.c index 140ec35293..a6f7ee82bb 100644 --- a/src/udev/udevd.c +++ b/src/udev/udevd.c @@ -549,6 +549,7 @@ static int worker_spawn(Manager *manager, struct event *event) { } static void event_run(Manager *manager, struct event *event) { + static bool log_children_max_reached = true; struct worker *worker; Iterator i; int r; @@ -573,11 +574,19 @@ static void event_run(Manager *manager, struct event *event) { } if (hashmap_size(manager->workers) >= arg_children_max) { - if (arg_children_max > 1) + + /* Avoid spamming the debug logs if the limit is already reached and + * many events still need to be processed */ + if (log_children_max_reached && arg_children_max > 1) { log_debug("Maximum number (%u) of children reached.", hashmap_size(manager->workers)); + log_children_max_reached = false; + } return; } + /* Re-enable the debug message for the next batch of events */ + log_children_max_reached = true; + /* start new worker and pass initial device */ worker_spawn(manager, event); } |