[systemd-devel] [PATCH 1/4] kdbus: add KDBUS_HELLO_CACHE_META to use the cached metadata

Djalal Harouni tixxdz at opendz.org
Fri Jun 27 03:32:05 PDT 2014


Collecting metadata for kdbus is a heavy operation, in the other hand it
is very useful and part of kdbus design. To reduce calls to
kdbus_meta_append() and the metadata collection overhead, introduce the
KDBUS_HELLO_CACHE_META flag that will only be available to privileged
bus users.

This flag will permit source connections to use the already cached
metadata from the handle or from HELLO instead of collecting the
metadata on each send operation. This improves benchmark tests by ~50%.

This will be available only to privileged bus users, in other words bus
owners. Applications that do not trust the bus owner should not connect
to that bus, bus owners are able to monitor to set policies...

This will also have dramatic performance improvements on cases where
you have a privileged connection that performs broadcast, other
unprivileged connections are interested on metadata but will not cause
the source connection to collect its data on every broadcast round.

This allows to provide metadata and reduce latency.

Signed-off-by: Djalal Harouni <tixxdz at opendz.org>
---
 kdbus.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/kdbus.h b/kdbus.h
index 0b189cb..f637203 100644
--- a/kdbus.h
+++ b/kdbus.h
@@ -486,12 +486,18 @@ enum kdbus_policy_type {
  *				registered with the name database
  * @KDBUS_HELLO_MONITOR:	Special-purpose connection to monitor
  *				bus traffic
+ * @KDBUS_HELLO_CACHE_META:	Instead of collecting and sending the
+ *				metadata of current process, the connection
+ *				will use the cached metadata and credentials
+ *				from the handle or from HELLO. Available
+ *				only to privileged bus users.
  */
 enum kdbus_hello_flags {
 	KDBUS_HELLO_ACCEPT_FD		=  1 <<  0,
 	KDBUS_HELLO_ACTIVATOR		=  1 <<  1,
 	KDBUS_HELLO_POLICY_HOLDER	=  1 <<  2,
 	KDBUS_HELLO_MONITOR		=  1 <<  3,
+	KDBUS_HELLO_CACHE_META		=  1 <<  4,
 };
 
 /**
-- 
1.9.3



More information about the systemd-devel mailing list