加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-udev-drop-unnecessary-calls-of-event_queue_start.patch 2.65 KB
一键复制 编辑 原始数据 按行查看 历史
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
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化