From 5fab6b7b18d0158c005a5bcf096face23377af72 Mon Sep 17 00:00:00 2001
From: Yu Watanabe <watanabe.yu+github@gmail.com>
Date: Fri, 26 Aug 2022 00:34:15 +0900
Subject: [PATCH] udev: drop unnecessary calls of event_queue_start()
 
As the subsequent call of on_post() will call it if necessary.
 
This also drop unnecessary call of event_source_disable() for killing
idle workers, as the event source is disabled in event_queue_start().
 
Reference:https://github.com/systemd/systemd/commit/5fab6b7b18d0158c005a5bcf096face23377af72
Conflict:adaption
 
---
 src/udev/udevd.c | 21 ---------------------
 1 file changed, 21 deletions(-)
 
diff --git a/src/udev/udevd.c b/src/udev/udevd.c
index b15a9d4..75e2086 100644
--- a/src/udev/udevd.c
+++ b/src/udev/udevd.c
@@ -1151,9 +1151,6 @@ static int on_uevent(sd_device_monitor *monitor, sd_device *dev, void *userdata)
 
         (void) event_queue_assume_block_device_unlocked(manager, dev);
 
-        /* we have fresh events, try to schedule them */
-        event_queue_start(manager);
-
         return 1;
 }
 
@@ -1220,9 +1217,6 @@ static int on_worker(sd_event_source *s, int fd, uint32_t revents, void *userdat
                 event_free(worker->event);
         }
 
-        /* we have free workers, try to schedule events */
-        event_queue_start(manager);
-
         return 1;
 }
 
@@ -1456,10 +1450,6 @@ static int on_inotify(sd_event_source *s, int fd, uint32_t revents, void *userda
 
         assert(manager);
 
-        r = event_source_disable(manager->kill_workers_event);
-        if (r < 0)
-                log_warning_errno(r, "Failed to disable event source for cleaning up idle workers, ignoring: %m");
-
         l = read(fd, &buffer, sizeof(buffer));
         if (l < 0) {
                 if (IN_SET(errno, EAGAIN, EINTR))
@@ -1516,7 +1506,6 @@ static int on_sighup(sd_event_source *s, const struct signalfd_siginfo *si, void
 
 static int on_sigchld(sd_event_source *s, const struct signalfd_siginfo *si, void *userdata) {
         Manager *manager = userdata;
-        int r;
 
         assert(manager);
 
@@ -1565,16 +1554,6 @@ static int on_sigchld(sd_event_source *s, const struct signalfd_siginfo *si, voi
                 worker_free(worker);
         }
 
-        /* we can start new workers, try to schedule events */
-        event_queue_start(manager);
-
-        /* Disable unnecessary cleanup event */
-        if (hashmap_isempty(manager->workers)) {
-                r = event_source_disable(manager->kill_workers_event);
-                if (r < 0)
-                        log_warning_errno(r, "Failed to disable event source for cleaning up idle workers, ignoring: %m");
-        }
-
         return 1;
 }
 
-- 
2.33.0
 