summaryrefslogtreecommitdiff
path: root/src/core/unit.h
diff options
context:
space:
mode:
authorKyle Walker <walker.kyle.t@gmail.com>2016-06-30 15:12:18 -0400
committerKyle Walker <walker.kyle.t@gmail.com>2016-06-30 15:16:47 -0400
commit36f20ae3b2975e44b6ef17e453ae06a289e9a122 (patch)
tree9fa9abeb4e1724e4c505f193e3b69cda57b732a4 /src/core/unit.h
parent7486322b99da5b4d2d00d35b310b035f936f7964 (diff)
manager: Only invoke a single sigchld per unit within a cleanup cycle
By default, each iteration of manager_dispatch_sigchld() results in a unit level sigchld event being invoked. For scope units, this results in a scope_sigchld_event() which can seemingly stall for workloads that have a large number of PIDs within the scope. The stall exhibits itself as a SIG_0 being initiated for each u->pids entry as a result of pid_is_unwaited(). v2: This patch resolves this condition by only paying to cost of a sigchld in the underlying scope unit once per sigchld iteration. A new "sigchldgen" member resides within the Unit struct. The Manager is incremented via the sd event loop, accessed via sd_event_get_iteration, and the Unit member is set to the same value as the manager each time that a sigchld event is invoked. If the Manager iteration value and Unit member match, the sigchld event is not invoked for that iteration.
Diffstat (limited to 'src/core/unit.h')
-rw-r--r--src/core/unit.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/core/unit.h b/src/core/unit.h
index 08a927962d..c41011ed9d 100644
--- a/src/core/unit.h
+++ b/src/core/unit.h
@@ -162,6 +162,9 @@ struct Unit {
* process SIGCHLD for */
Set *pids;
+ /* Used in sigchld event invocation to avoid repeat events being invoked */
+ uint64_t sigchldgen;
+
/* Used during GC sweeps */
unsigned gc_marker;