Off-topic: D-Bus in the kernel
alban.crequy at collabora.co.uk
Mon Sep 20 06:38:34 PDT 2010
Le Fri, 17 Sep 2010 11:47:28 -0400,
Havoc Pennington <hp at pobox.com> a écrit :
> >> How much of the perf gain is due to different
> >> behavior/semantics vs. avoiding the context switch and copies?
> > I don't know, I need to test that. Is there an easy way to disable
> > validation in dbus-daemon?
> Yeah, there is a pretty easy code hack. in
> dbus-message.c:load_message() change the validation mode set at the
> This still won't disable header _parsing_ though which is itself a lot
> slower than it should be in libdbus. The only performance thing
> libdbus really gets right is that it avoids a lot of gratuitous
> copying of the message.
I ran the test dbus-ping-pong on KVM/i386 with 50.000 calls using this
patch to enable and disable the validation:
@@ -3913,7 +3913,7 @@
dbus_uint32_t n_unix_fds = 0;
- mode = DBUS_VALIDATION_MODE_DATA_IS_UNTRUSTED;
+ mode = DBUS_VALIDATION_MODE_WE_TRUST_THIS_DATA_ABSOLUTELY;
oom = FALSE;
I can enable or disable the validation in dbus-ping-pong and in
dbus-daemon separately because once a program is dynamically linked to
a version of libdbus, it stays to that version in memory when I update
libdbus to another version.
First, results without kdbus:
- Validation enabled: 19.2s
- Validation in client only: 18.4s
- Validation in server only: 18.3s
- Validation disabled: 17.7s (-8%)
Then, results with kdbus:
- Validation enabled: 9.3s
- Validation in client only: 9.3s
- Validation in server only: 8.4s
- Validation disabled: 8.4s (-9%)
The improved performance without validation are limited in this test
because the D-Bus messages in dbus-ping-pong contain only a short
string "Hello world". But 8% or 9% is still important.
In the kdbus tests, whether validation in dbus-daemon is enabled does
not change the results. This is consistent since dbus-daemon does not
receive the messages.
The duration with kdbus are around half the duration without kdbus.
More information about the dbus