98 lines
2.9 KiB
Diff
98 lines
2.9 KiB
Diff
From 2d07173304abd3f1d3fae5e0f01bf5874b1f04db Mon Sep 17 00:00:00 2001
|
|
From: David Herrmann <dh.herrmann@gmail.com>
|
|
Date: Tue, 29 Sep 2015 20:56:17 +0200
|
|
Subject: [PATCH 16/20] sd-event: don't provide priority stability
|
|
|
|
Currently, we guarantee that if two event-sources with the same priority
|
|
fire at the same time, they're always dispatched in the same order. While
|
|
this might sound nice in theory, there's is little benefit in providing
|
|
stability on that level. We have no control over the order the events are
|
|
reported, hence, we cannot guarantee that we get notified about both at
|
|
the same time.
|
|
|
|
By dropping the stability guarantee, we loose roughly 10% Heap swaps in
|
|
the prioq on a desktop cold-boot. Krzysztof Kotlenga even reported up to
|
|
20% on his tests. This sounds worth optimizing, so drop the stability
|
|
guarantee.
|
|
|
|
[commit 6fe869c251790a0e3cef5b243169dda363723f49 from
|
|
https://github.com/systemd-rhel/rhel-8/]
|
|
|
|
Signed-off-by: Li Zhou <li.zhou@windriver.com>
|
|
---
|
|
src/libsystemd/sd-event/sd-event.c | 30 ------------------------------
|
|
1 file changed, 30 deletions(-)
|
|
|
|
diff --git a/src/libsystemd/sd-event/sd-event.c b/src/libsystemd/sd-event/sd-event.c
|
|
index e34fd0b..6304991 100644
|
|
--- a/src/libsystemd/sd-event/sd-event.c
|
|
+++ b/src/libsystemd/sd-event/sd-event.c
|
|
@@ -243,12 +243,6 @@ static int pending_prioq_compare(const void *a, const void *b) {
|
|
if (x->pending_iteration > y->pending_iteration)
|
|
return 1;
|
|
|
|
- /* Stability for the rest */
|
|
- if (x < y)
|
|
- return -1;
|
|
- if (x > y)
|
|
- return 1;
|
|
-
|
|
return 0;
|
|
}
|
|
|
|
@@ -278,12 +272,6 @@ static int prepare_prioq_compare(const void *a, const void *b) {
|
|
if (x->priority > y->priority)
|
|
return 1;
|
|
|
|
- /* Stability for the rest */
|
|
- if (x < y)
|
|
- return -1;
|
|
- if (x > y)
|
|
- return 1;
|
|
-
|
|
return 0;
|
|
}
|
|
|
|
@@ -311,12 +299,6 @@ static int earliest_time_prioq_compare(const void *a, const void *b) {
|
|
if (x->time.next > y->time.next)
|
|
return 1;
|
|
|
|
- /* Stability for the rest */
|
|
- if (x < y)
|
|
- return -1;
|
|
- if (x > y)
|
|
- return 1;
|
|
-
|
|
return 0;
|
|
}
|
|
|
|
@@ -344,12 +326,6 @@ static int latest_time_prioq_compare(const void *a, const void *b) {
|
|
if (x->time.next + x->time.accuracy > y->time.next + y->time.accuracy)
|
|
return 1;
|
|
|
|
- /* Stability for the rest */
|
|
- if (x < y)
|
|
- return -1;
|
|
- if (x > y)
|
|
- return 1;
|
|
-
|
|
return 0;
|
|
}
|
|
|
|
@@ -371,12 +347,6 @@ static int exit_prioq_compare(const void *a, const void *b) {
|
|
if (x->priority > y->priority)
|
|
return 1;
|
|
|
|
- /* Stability for the rest */
|
|
- if (x < y)
|
|
- return -1;
|
|
- if (x > y)
|
|
- return 1;
|
|
-
|
|
return 0;
|
|
}
|
|
|
|
--
|
|
2.17.1
|
|
|