summaryrefslogtreecommitdiff
path: root/src/core/load-dropin.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2020-05-27 15:49:17 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2020-06-10 09:36:58 +0200
commit4562c35527c199e1ed9b41d78c0dd81c88c655c9 (patch)
treea7888c25a109b9d05e1e4af86be2ca11611469a1 /src/core/load-dropin.c
parent9ff7c5b031fb95783884f1e755b5875712f46ea5 (diff)
downloadsystemd-4562c35527c199e1ed9b41d78c0dd81c88c655c9.tar.gz
core: store unit aliases in a separate set
We allocated the names set for each unit, but in the majority of cases, we'd put only one name in the set: $ systemctl show --value -p Names '*'|grep .|grep -v ' '|wc -l 564 $ systemctl show --value -p Names '*'|grep .|grep ' '|wc -l 16 So let's add a separate .id field, and only store aliases in the set, and only create the set if there's at least one alias. This requires a bit of gymnastics in the code, but I think this optimization is worth the trouble, because we save one object for many loaded units. In particular set_complete_move() wasn't very useful because the target unit would always have at least one name defined, i.e. the optimization to move the whole set over would never fire.
Diffstat (limited to 'src/core/load-dropin.c')
-rw-r--r--src/core/load-dropin.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/core/load-dropin.c b/src/core/load-dropin.c
index f61e9da6f2..9bc6857cdf 100644
--- a/src/core/load-dropin.c
+++ b/src/core/load-dropin.c
@@ -19,9 +19,8 @@ static int process_deps(Unit *u, UnitDependency dependency, const char *dir_suff
r = unit_file_find_dropin_paths(NULL,
u->manager->lookup_paths.search_path,
u->manager->unit_path_cache,
- dir_suffix,
- NULL,
- u->names,
+ dir_suffix, NULL,
+ u->id, u->aliases,
&paths);
if (r < 0)
return r;